我想在我的Ngnix Web服务器上配置我的codeigniter应用程序,因为它在apache服务器上运行完美。
我已按照以下链接进行操作,但始终显示502错误的网关错误。
https://gist.github.com/lynxluna/1050850
http://www.nginxtips.com/codeigniter-nginx-configuration/
https://gist.github.com/stefan-vatov/4451834
nginx codeigniter 502 bad gateway
我的应用程序位于/var/www/example
我在/etc/ngnix/sites-enabled/example
创建了虚拟主机文件,其中包含以下代码
server {
listen 8080 default_server;
listen [::]:8080 default_server ipv6only=on;
server_name example;
root /var/www/example;
index index.php index.html index.htm;
location / {
root /var/www/example;
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php($|/) {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
如果我在浏览器localhost上运行它:8080它会抛出一个错误,任何人都可以帮我解决这个问题吗?