Skip to content

Instantly share code, notes, and snippets.

@synsh
Created May 13, 2018 15:18
Show Gist options
  • Save synsh/7ac1ab7b54deb319935ca448ee84037e to your computer and use it in GitHub Desktop.
Save synsh/7ac1ab7b54deb319935ca448ee84037e to your computer and use it in GitHub Desktop.
#user nobody;
worker_processes auto;
worker_rlimit_nofile 2048;
error_log /var/log/nginx/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 2048;
}
http {
server_tokens off;
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr:$http_x_remote_port - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$host" sn="$server_name" '
'rt=$request_time '
'ua="$upstream_addr" us="$upstream_status" '
'ut="$upstream_response_time" ul="$upstream_response_length" '
'cs=$upstream_cache_status' ;
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# Websocket support
#upstream websocket {
# server 127.0.0.1:<PORT>;
#}
server {
listen 80;
listen [::]:80;
server_name data.saletancy.com;
#ssl_certificate /etc/nginx/ssl/nginx.crt;
#ssl_certificate_key /etc/nginx/ssl/nginx.ke
#charset koi8-r;
#access_log logs/host.access.log main;
include /etc/nginx/aliases.conf;
#location /ws {
# proxy_pass http://websocket;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "Upgrade";
#}
if ($http_x_remote_port = '' ) {
set $http_x_remote_port $remote_port;
}
location / {
root /var/www/webroot/ROOT;
index index.html index.htm index.php;
try_files $uri $uri/ /index.php;
location ~ \.php$ {
location ~ /\. { deny all; access_log off; log_not_found off; }
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
}
index index.php index.html index.htm;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
location ~ /\. { deny all; access_log off; log_not_found off; }
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
location ~ \.php$ {
location ~ /\. { deny all; access_log off; log_not_found off; }
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/webroot$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /var/www/webroot;
}
}
include /etc/nginx/conf.d/*.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment