Hi, thank you tyrro for your prompt and valuable reply.
That configuration seems a bit different, but I tried to adjust that to my situation. After quite a few time’s crashes (yes, nginx just cannot load and a few times, 502 bad gateway alert), I realized it was more than I could figure out where the problem lies and the problem is on the main config file.
With ee, the default-ly generated conf is sth like this(suppose my domain name is forum.example.com, and I’ll put the phpbb scripts all under the doc root, that is, /var/www/forum.example.com/htdocs/
dir):
server {
server_name forum.example.com www.forum.example.com;
access_log /var/log/nginx/forum.example.com.access.log rt_cache;
error_log /var/log/nginx/forum.example.com.error.log;
root /var/www/forum.example.com/htdocs;
index index.php index.html index.htm;
include common/php.conf;
include common/locations.conf;
include /var/www/forum.example/conf/nginx/*.conf;
}
I then think the step six codes shall be inserted somewhere into the above blocks. I did it and after a few rounds, made the following thing.
server {
listen 80;
server_name forum.example.com www.forum.example.com;
root /var/www/forum.example.com/htdocs;
index index.php index.html index.htm;
access_log /var/log/nginx/forum.example.com.access.log rt_cache;
error_log /var/log/nginx/forum.example.com.error.log;
location / {
try_files $uri $uri/ @rewriteapp;
}
location /install/ {
try_files $uri $uri/ @rewrite_installapp;
}
location ~ \.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
#fastcgi_pass 127.0.0.1:9000
fastcgi_pass unix:/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /install/app.php$is_args$args;
}
location @rewrite_installapp {
rewrite ^(.*)$ /install/app.php/$1 last;
}
#include common/php.conf;
include common/locations.conf;
include /var/www/forum.example.com/conf/nginx/*.conf;
}
Now, it could be found that I made two comment marks. One is that I commented the php.conf include line, because restarting nginx generated error msg pointing out sth wrong with that php.conf while ee’s original php.conf file says sth like do not modify. The other is the fastcgi_pass block. I turned it from TCP to CGI way and made it complied with conf.d/upsteam.conf
file.
After restarting and rebooting, the installation dir still gave me a 502 bad gateway msg while visiting other non-php dir/files is ok.
I think one of the hard ways is that there are more than one conf to be taken aware of when they include one another.