【发布时间】:2017-09-28 13:56:46
【问题描述】:
我正在尝试使用带有别名的虚拟主机来部署 Laravel 应用程序。 在 ubuntu 16.04 中使用 apache2。
我的 000.conf 文件是:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options -Indexes
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/public
Alias /expediente "/var/www/public/"
<Directory /var/www/public/>
Options -Indexes
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>
</VirtualHost>
第一个工作正常,但第二个不行。
我做错了什么?
==============
编辑
好的,所以我在站点中创建了两个可用的 conf 文件,并将它们符号链接到启用站点。
advanced.conf
<VirtualHost *:80>
ServerAdmin admin@localhost
ServerName ip-address:80/advanced
ServerAlias /advanced
DocumentRoot /var/www/html/advanced
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
expediente.conf
<VirtualHost *:80>
ServerAdmin admin@localhost
ServerName ip-address:80/expediente
ServerAlias /expediente
DocumentRoot /var/www/html/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
重新加载并重新启动 apache2。
如果我尝试导航到 ip-address/ 我会得到第一页,即高级页面, 如果我尝试导航到 ip-address/advanced 404 not found 如果我尝试导航到 ip-address/expediente 404 not found
我做错了什么?
【问题讨论】:
标签: php laravel ubuntu apache2 virtualhost