【问题标题】:SetUp Apache VirtualHost (CentOs)设置 Apache 虚拟主机 (CentOs)
【发布时间】:2017-05-30 20:29:35
【问题描述】:

如何在 linux 上为新域名设置 VirtualHost? 就像,

而且,我在 /opt/lampp/etc/extra/httpd-vhosts.conf

中添加了此内容
> NameVirtualHost *:80
> 
> <VirtualHost *:80>
>   DocumentRoot "/opt/lampp/htdocs"
>   ServerName localhost
> </VirtualHost>
> 
> <VirtualHost *:80>
>   DocumentRoot "/opt/lampp/htdocs/weblog.localhost/mvc_htdocs"
>   ServerName weblog.localhost
>   DirectoryIndex index.php index.html
> </VirtualHost>

我在 /opt/lampp/etc/httpd.conf 中删除了 Include etc/extra/httpd-vhosts.conf 前面的 #

但是当我输入我的新域时出现一个空网站。

请帮帮我。谢谢:)

【问题讨论】:

    标签: php linux apache


    【解决方案1】:

    你必须在“/etc/httpd/conf.d/”中为这个虚拟主机创建一个新的配置文件。创建一个新文件 vhost1.conf(您可以选择任何合适的名称)。在下面输入代码。

    <VirtualHost *:80>
    ServerName weblog.localhost
    DocumentRoot /opt/lampp/htdocs/weblog.localhost/mvc_htdocs
    DirectoryIndex index.php index.html
    </VirtualHost>
    

    保存并退出文件。重启httpd服务。

    【讨论】:

      【解决方案2】:
          // Consider your project directory path is this 
             var/www/html/deepbase
          
          // If you are using only https then specify 
          //this tag <VirtualHost 10.77.22.110:443>(Domain Name:ssl port no.) only.
          
          // Restart Apache for the changes to take effect | very important point
          // systemctl restart httpd.service 
          
          //<VirtualHost *:443>
          <VirtualHost 10.77.22.110:443>
              SSLEngine On
              SSLCertificateFile /etc/pki/tls/certs/25oct2021/wildcard_utiamc_com.crt
              SSLCertificateKeyFile /etc/pki/tls/certs/25oct2021/private.key
              ServerName www.bop-uat.deepbase.com
              ServerAlias bop-uat.deepbase.com
              ServerAdmin webmaster@deepbase.com
              DocumentRoot /var/www/html/deepbase
              LogLevel warn
              ErrorLog /var/www/deepbase/logs/error.log
              CustomLog /var/www/deepbase/logs/access.log combined
          </VirtualHost>
      

      【讨论】:

        猜你喜欢
        • 2013-07-31
        • 2014-02-07
        • 2013-10-20
        • 2012-04-22
        • 1970-01-01
        • 1970-01-01
        • 2011-02-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多