Skip to content

Instantly share code, notes, and snippets.

@GeekGhc
Created August 14, 2019 07:24
Show Gist options
  • Save GeekGhc/0c334412c7f17e34daf5e07375ccbaa5 to your computer and use it in GitHub Desktop.
Save GeekGhc/0c334412c7f17e34daf5e07375ccbaa5 to your computer and use it in GitHub Desktop.
upstream swoole {
# By IP:Port, php7 is the name of php7 container
server 127.0.0.1:5200 weight=5 max_fails=3 fail_timeout=30s;
# By UnixSocket Stream file
#server unix:/docker/www/laravel-s-test/storage/laravels.sock weight=5 max_fails=3 fail_timeout=30s;
#server php7:5201 weight=3 max_fails=3 fail_timeout=30s;
#server php7:5202 backup;
keepalive 16;
}
server {
listen 2020;
set $root_path '/data/webapps/mob_scs/public';
root $root_path;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location / {
try_files $uri @laravels;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:5200;
fastcgi_index /index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param APP_ENV test;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
location ~ /\.ht {
deny all;
}
location @laravels {
proxy_http_version 1.1;
# proxy_connect_timeout 60s;
# proxy_send_timeout 60s;
# proxy_read_timeout 120s;
proxy_set_header Connection "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header Server-Protocol $server_protocol;
proxy_set_header Server-Name $server_name;
proxy_set_header Server-Addr $server_addr;
proxy_set_header Server-Port $server_port;
proxy_pass http://swoole;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment