以下nginx.conf是之前服务器nginx1.10.2+php7.0.22的配置文件,现在改用宝塔了,请问添加站点后站点的配置文件要如何修改和配置呢?
之前服务器的环境是别人配置的,API打开地址是:http://api.xxxxxx.com/api 现在用宝塔添加站点后,server_name为api.xxxxxx.com,还有下面的红色部分我也添加到了配置文件,可是打开http://api.xxxxxx.com/api会出现404错误 “404,您请求的文件不存在!” ,是不是还需要设置什么地方呢?
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
server_name _;
root /usr/share/nginx/webapp;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
index index.php;
if (!-e $request_filename) {
rewrite ^/(api)/(.*)$ /api.php?s=/$2 last;
rewrite ^/(share)/(.*)$ /share.php?s=/$2 last;
rewrite ^/(.*)$ /index.php?s=/$2 last;
break;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root webapp;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
|
|