【发布时间】:2023-04-02 07:30:01
【问题描述】:
好的 现在我用 apache 和 nginx 代理在 ubuntu 14.4 上安装了 laravel 4.2。
当我创建像
这样的路线时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;
}
}
哪里错了?
【问题讨论】:
标签: apache nginx laravel-4 ubuntu-14.04