server { listen 80; index index.php; server_name localhost; root /var/www/html/public; location / { # try_files $uri $uri/ /index.php?$query_string; if (!-e $request_filename){ # rewrite ^(.*)$ /FTjJZpQbzx.php?s=$1 last; break; rewrite ^(.*)$ /index.php?s=$1 last; break; } } location ~ \.php$ { fastcgi_pass php74:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location /sync-api { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; rewrite ^/sync-api/(.*)$ /$1 break; #重写 proxy_pass http://local-sync-server:8888; # 设置代理服务器的协议和地址 } }