Skip to content

Instantly share code, notes, and snippets.

@zacksleo
Created November 3, 2018 14:57
Show Gist options
  • Save zacksleo/256c6977329aa027ce926261e9be7124 to your computer and use it in GitHub Desktop.
Save zacksleo/256c6977329aa027ce926261e9be7124 to your computer and use it in GitHub Desktop.
laravel swoole
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
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;
keepalive_timeout 65;
gzip on;
upstream icontact_pool {
server web:9001 weight=5 max_fails=3 fail_timeout=10s;
server web2:9001 weight=5 max_fails=3 fail_timeout=10s;
server web3:9001 weight=5 max_fails=3 fail_timeout=10s;
server web4:9001 weight=5 max_fails=3 fail_timeout=10s;
server web5:9001 weight=5 max_fails=3 fail_timeout=10s;
}
upstream icontact_pool2 {
server web:9000 weight=5 max_fails=3 fail_timeout=10s;
server web2:9000 weight=5 max_fails=3 fail_timeout=10s;
server web3:9000 weight=5 max_fails=3 fail_timeout=10s;
server web4:9000 weight=5 max_fails=3 fail_timeout=10s;
server web5:9000 weight=5 max_fails=3 fail_timeout=10s;
}
server {
listen 80;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains;preload" always;
charset utf-8;
client_max_body_size 128M;
root /var/www/html/public;
location /api/ {
try_files $uri @swoole;
}
location @swoole {
proxy_http_version 1.1;
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 120s;
proxy_set_header Connection "keep-alive";
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://web:9001;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_index index.php;
include fastcgi_params;
fastcgi_pass web:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files $uri =404;
}
location ~ \.(ht|svn|git|env) {
deny all;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment