nginx配置php
nginx.conf
usernginx;
worker_processesauto;
error_log/var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections1024;
}
http {
include /etc/nginx/mime.types;
default_typeapplication/octet-stream;
log_formatmain'$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.logmain;
sendfile on;
#tcp_nopush on;
keepalive_timeout65;
#gzipon;
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
server_namelocalhost;
location / {
root /data/www/file;
index /promotion/jc_app_downlaod.html;
}
error_page 500 502 503 504/50x.html;
location = /50x.html {
root html;
}
}
}
conf.d/xx.conf
# admin-api
server {
listen 8102;
server_name 192.168.124.48;
root /data/www/admin-api/public;
client_max_body_size 18M;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
fastcgi_paramAPP_ENV dev;
include fastcgi_params;
}
location ~/\.ht {
deny all;
}
}
# admin web
server {
listen 8110;
server_name 192.168.124.48;
location / {
root /data/web/admin/dist/;
indexindex.html;
}
location ^~/api/ {
proxy_pass http://127.0.0.1:8102/;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
}
}
server {
listen 8080;
server_name 192.168.124.48;
location / {
root /var/www;
index index.html index.htm;
}
# location custom_service {
#}
}
页:
[1]