Skip to content

Instantly share code, notes, and snippets.

@itsmelion
Created February 14, 2018 02:50
Show Gist options
  • Save itsmelion/a16f7cc549d80a1ea6548a730c952deb to your computer and use it in GitHub Desktop.
Save itsmelion/a16f7cc549d80a1ea6548a730c952deb to your computer and use it in GitHub Desktop.
Nginx Base config
#load_module "modules/ngx_http_image_filter_module.so";
#load_module "modules/ngx_http_perl_module.so";
#load_module "modules/ngx_http_xslt_filter_module.so";
#load_module "modules/ngx_mail_module.so";
#load_module "modules/ngx_stream_module.so";
error_log ~/nginx/logs/error.log debug;
user lion staff;
worker_processes 2;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
gzip on;
gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
sendfile on;
client_max_body_size 500M;
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 ~/nginx/logs/access.log main;
keepalive_timeout 65;
server {
listen 80 default_server;
# MAMP DOCUMENT_ROOT !! Don't remove this line !!
root "/Users/lion/sites";
location / {
index index.html index.php;
}
location ~* \favicon.ico$/ {
alias /Applications/MAMP/bin/favicon.ico;
log_not_found off;
access_log off;
}
location ~ /\. {
deny all;
}
location ~* \.(gif|jpe?g|png|pdf|svg)$ {
expires 30d;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(txt|log)$ {
allow 127.0.0.1;
deny all;
}
# location ~ \..*/.*\.php$ {
# return 403;
# }
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
include ~/sites/sites-enabled/*;
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment