Skip to content

Instantly share code, notes, and snippets.

@parsibox
Last active August 4, 2019 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parsibox/6dc2c8b0ebc5aa2c5a7f0dd69204699b to your computer and use it in GitHub Desktop.
Save parsibox/6dc2c8b0ebc5aa2c5a7f0dd69204699b to your computer and use it in GitHub Desktop.
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024000;
use epoll;
}
worker_rlimit_nofile 1024000;
http {
upstream mohsendavari {
#least_conn;
#max_fails=10 fail_timeout=30s
server 127.0.0.1:9070 ;
server 10.0.72.22:9071 max_fails=10 fail_timeout=40s;
server 10.0.72.22:9070 max_fails=10 fail_timeout=40s;
server 127.0.0.1:9071 max_fails=10 fail_timeout=40s;
}
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $upstream_addr time:$request_time';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 30;
types_hash_max_size 2048;
#davari
index index.php index.html index.htm;
client_max_body_size 7000M;
fastcgi_ignore_client_abort on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
absolute_redirect off;
port_in_redirect off;
server_name_in_redirect off;
listen 8181 default_server;
listen [::]:8181 default_server;
server_name _;
root /var/www/html;
gzip on;
# Enable compression both for HTTP/1.0 and HTTP/1.1.
gzip_http_version 1.1;
# Compression level (1-9).
# 5 is a perfect compromise between size and cpu usage, offering about
# 75% reduction for most ascii files (almost identical to level 9).
gzip_comp_level 5;
# Don't compress anything that's already small and unlikely to shrink much
# if at all (the default is 20 bytes, which is bad as that usually leads to
# larger files after gzipping).
gzip_min_length 256;
# Compress data even for clients that are connecting to us via proxies,
# identified by the "Via" header (required for CloudFront).
gzip_proxied any;
# Tell proxies to cache both the gzipped and regular version of a resource
# whenever the client's Accept-Encoding capabilities header varies;
# Avoids the issue where a non-gzip capable client (which is extremely rare
# today) would display gibberish if their proxy gave them the gzipped version.
gzip_vary on;
# Compress all output labeled with one of the following MIME-types.
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component;
# text/html is always compressed by HttpGzipModule
location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|ttf|eot|woff2)$ {
expires 30d;
access_log off;
add_header Cache-Control "public";
}
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location = / {
try_files $uri $uri/ /index.php;
rewrite ^/(.*)$ /index.php;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ^~ /core {
root /var/www/html;
location ~* \.php {
try_files $uri =404;
# fastcgi_pass 127.0.0.1:9001;
fastcgi_pass mohsendavari;
fastcgi_next_upstream off;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
rewrite ^/fullmode/(.*)/([0-9]+).html$ /$1.php?id=$2 last;
rewrite ^/fullmode/(.*).html$ /$1.php last;
rewrite ^/webservice/rest/(.*)$ /webservice/rest/api.php?request=$1$args last;
location ~ \.php$ {
try_files $uri =404;
fastcgi_read_timeout 360000000;
fastcgi_connect_timeout 360000000;
fastcgi_pass 127.0.0.1:9070;
#fastcgi_pass unix:/var/run/php70.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl http2 default_server;
# listen [::]:443 ssl http2 default_server;
# server_name _;
# root /usr/share/nginx/html;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# location / {
# }
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment