Apache 路由将我重定向到主页(laravel)
嗯 现在我用apache和nginx代理在Ubuntu14.4上安装了Laravel4.2 当我创建类似于Apache 路由将我重定向到主页(laravel),apache,nginx,laravel-4,ubuntu-14.04,Apache,Nginx,Laravel 4,Ubuntu 14.04,嗯 现在我用apache和nginx代理在Ubuntu14.4上安装了Laravel4.2 当我创建类似于 Route::get('/reg', function() { return 'hii'; }); 调用“localhost:8080/reg”时的apache视图“hii” 但当我在浏览器中调用“localhost/reg”时,nginx会查看主页 nginx配置: server { listen 80; root /var/www/lar
Route::get('/reg', function()
{
return 'hii';
});
调用“localhost:8080/reg”时的apache视图“hii”
但当我在浏览器中调用“localhost/reg”时,nginx会查看主页
nginx配置:
server {
listen 80;
root /var/www/laravel/public;
index index.php index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
# PHP FPM configuration.
location ~* \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script$
}
location ~ /\.ht {
deny all;
}
}
哪里错了?根据您的
nginx.conf
,它正在加载您的/var/www/laravel/public/index.php代码>。如果你不想发生这种事
- 将
nginx.conf
中的路径调整为要加载的文件
或
- 创建一个视图,然后指向该视图的路径