我想将laravel配置为每当用户访问domain/api
时实际访问公用文件夹
我试过以下
1.使用
处理文件laravel.conf<VirtualHost *:80>
ServerName ipaddress/api
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/api/public
<Directory /var/www/html/api>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
然后
sudo a2dissite 000-default.conf //disabled defaul loading
sudo a2ensite laravel.conf
sudo a2enmod rewrite
sudo service apache2 restart
但现在上面的失败
但是在虚拟主机配置上,当我在没有api的情况下servername to ipaddress
每当我访问ip地址时它会读取api / public但是我想在用户访问时读取api / public
ipaddress/api.
我还需要添加什么?
我跟着 This tutorial
答案 0 :(得分:0)
我不是Apache配置方面的专家,因此我不确定您拥有的内容与教程使用的内容之间有何不同。
但是,我的网站设置类似,但我的网站看起来有点不同:
DocumentRoot /var/www/website/public
<Directory /var/www/website/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
了解您的配置:
<VirtualHost *:80>
ServerName ipaddress/api
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/api/public
<Directory /var/www/html/api/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
或许试一试,看看是否有帮助。