Nginx global conf 用于启动脚本 php

定制 Nginx 用于应用程序处理 PHP, 你可以创建

奉献者

conf 在下面

sites-available

然后创建一个适当的符号链接

sites-enabled

, 但我不想使用这种方法 - 我更喜欢一个

全球的

conf 用于启动脚本 php 所有项目。 可以放在里面的东西

nginx.conf

. 我没有找到这样一个全球cff。

是否有全局配置 Nginx 用于启动脚本 php?
已邀请:

喜特乐

赞同来自:

类似的东西。 您只需根据其域名将项目保存在文件夹中。 ($ host). 检查变量 nginx:
http://nginx.org/en/docs/http/ ... _host
user  www-data;
worker_processes 4;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 8192;
}


http {
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;

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;
#gzip on;



server {
listen 80 default_server;

root /var/www/$host;
index index.php;

location / {
try_files $uri $uri/ /index.php?$args;
}

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 24h;
log_not_found off;
}

location ~ /\. { access_log off; log_not_found off; deny all; }

rewrite /files/$ /index.php last;

if ($uri !~ wp-content/plugins) {
rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
}

location ~ \.php$ {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
client_max_body_size 25M;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
}

要回复问题请先登录注册