我在/home/user/development
安装了一个laravel项目。该项目称为rpm(/home/user/development/rpm
)。我还有一个我在/home/public_html
使用过的项目。它被称为mgmt(/home/user/public_html/mgmt
)。我可以通过 localhost / mgmt 导航到mgmt。 sites-available
中的conf文件是
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/user/public_html/
<Directory /home/user/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/rpm-error.log
CustomLog ${APACHE_LOG_DIR}/rpm-access.log combined
</VirtualHost>
现在我的laravel项目(rpm)不起作用。导航到 localhost / rpm 会给出404。 它的conf文件看起来像这样
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/user/development/rpm/public/
Alias /rpm /home/user/development/rpm/public
<Directory /home/user/development/rpm/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/rpm-error.log
CustomLog ${APACHE_LOG_DIR}/rpm-access.log combined
</VirtualHost>
这可能是什么问题?这两个配置文件都在sites-enabled
文件夹中有符号链接。
答案 0 :(得分:1)
将第一个conf修改为此。丢弃第二个conf。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/user/public_html/
Alias /rpm /home/user/development/rpm/public
<Directory /home/user/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /home/user/development/rpm/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/rpm-error.log
CustomLog ${APACHE_LOG_DIR}/rpm-access.log combined
</VirtualHost>