[英]SetUp Apache VirtualHost (CentOs)
如何在 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>
我刪除了#前面的Include etc/extra/httpd-vhosts.conf在/opt/lampp/etc/httpd.conf
但是當我輸入我的新域名時會出現一個空的網站。
請給我一個幫助。 謝謝:)
您必須在“ /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服務。
// 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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.