我有一個小問題。
我有一個配置了 Apache 的 VPS,我有 2 個 VH,一個是 mydomain.com,另一個是 subdomain.mydomain.com
問題是,每當我在瀏覽器中輸入 VPS IP 時,它都會轉到子域。有沒有辦法將其默認為主域?
我創建了一個名為 sites-enabled 的檔案夾,其中包含兩個組態檔,它們看起來像這樣。
示例.net.conf:
<VirtualHost *:80>
ServerName example.net
ServerAlias www.example.net
DocumentRoot /var/www/example.net
<Directory /var/www/example.net>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
admin.example.net.conf:
<VirtualHost *:80>
ServerName admin.example.net
DocumentRoot /var/www/admin.example.net
DirectoryIndex index.html
ErrorLog ${APACHE_LOG_DIR}/admin.example.net.log
CustomLog ${APACHE_LOG_DIR}/admin.example.net.log combined
</VirtualHost>
如何將第一個設定為默認值?
uj5u.com熱心網友回復:
將以下代碼放在 000-default.conf 檔案中
<VirtualHost *:80>
DocumentRoot /var/www/example.net
<Directory /var/www/example.net>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/317876.html
