这是我的nginx文件的样子。但是当我使用ip浏览我的服务器时,我仍然是“欢迎来到nginx!”页面
server {
listen 127.0.0.1:9070;
root /var/www/[redacted]/public/;
index index.php index.html index.htm;
server_name [redacted];
location / {
try_files $uri $uri/ /index.php$is_args$args;
allow 127.0.0.1;
deny all;
}
# pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
答案 0 :(得分:1)
我相信您会发现将允许/拒绝移入server
子句会清除这一点:
server {
listen 127.0.0.1:9070;
root /var/www/[redacted]/public/;
index index.php index.html index.htm;
server_name [redacted];
location / {
try_files $uri $uri/ /index.php$is_args$args;
allow 127.0.0.1;
deny all;
}
变为:
server {
listen 127.0.0.1:9070;
root /var/www/[redacted]/public/;
index index.php index.html index.htm;
server_name [redacted];
allow 127.0.0.1;
deny all;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}