[英]Not able to access laravel routes in apache2 server
I've deployed a new laravel installation to my server, While doing so I configured my apache2 as following: 我已经在我的服务器上部署了一个新的laravel安装,同时这样做我将apache2配置如下:
I added 000-default.conf
file in /etc/apache2/sites-available/
as following: 我在
/etc/apache2/sites-available/
添加了000-default.conf
文件,如下所示:
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
Require all granted
</Directory>
I've my laravel installed into /var/www/html/stellar
folder now I access my installation through: 我将laravel安装到
/var/www/html/stellar
文件夹中,现在通过以下方式访问我的安装:
http://52.39.175.55/stellar/public/
But while calling the routes it is not working, Like 但是在调用路线时它不起作用,就像
http://52.39.175.55/stellar/public/oauth/token
But suppose I call through this: 但是假设我打电话通过:
http://52.39.175.55/stellar/public/index.php/oauth/token
I get the access, 我得到了访问权限,
I tried changing my public/.htaccess
file to something like this: 我尝试将我的
public/.htaccess
文件更改为以下内容:
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /stellar
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
Still there is no change, Help me out in this. 仍然没有变化,请帮我解决这个问题。
Your VirtualHost on /etc/apache2/sites-available/
should look like this: 您在
/etc/apache2/sites-available/
上的VirtualHost应如下所示:
<VirtualHost *:80>
DocumentRoot "/var/www/html/stellar/public"
ServerName yourdomain.com
<Directory /var/www/html/stellar/public>
AllowOverride All
</Directory>
</VirtualHost>
Then restart apache2 and it should work. 然后重启apache2,它应该工作。
I hardly recommend you to duplicate the 000-default.conf
file, rename it and include the VirtualHost, then enable it with a2ensite
command, just because it's more easy to manage. 我几乎不建议您复制
000-default.conf
文件,重命名它并包含VirtualHost,然后使用a2ensite
命令启用它,因为它更容易管理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.