Skip to content

Instantly share code, notes, and snippets.

@geta6
Last active December 16, 2015 04:59
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 geta6/5380833 to your computer and use it in GitHub Desktop.
Save geta6/5380833 to your computer and use it in GitHub Desktop.
upstream favorymous {
server 127.0.0.1:3032;
}
server {
listen 80;
charset UTF-8;
server_name favorymous.com;
root /var/www/com.favorymous.www/public;
location / {
try_files $uri $uri/index.html $uri.html @favorymous;
}
location @favorymous {
include includes/proxy.conf;
proxy_pass http://favorymous;
}
}
server {
listen 80;
server_name *.favorymous.com;
rewrite ^ http://favorymous.com$request_uri? permanent;
}
upstream geta6_net {
server 127.0.0.1:3030;
}
server {
listen 443;
charset UTF-8;
server_name geta6.net;
root /var/www/net.geta6.www/public;
ssl on;
ssl_certificate certs/net.geta6.auth.crt;
ssl_certificate_key certs/net.geta6.auth.key;
access_log /usr/local/var/log/nginx/geta6_access.log;
error_log /usr/local/var/log/nginx/geta6_error.log;
location / {
try_files $uri $uri/index.html $uri.html @geta6_net;
}
location @geta6_net {
include includes/proxy.conf;
proxy_pass http://geta6_net;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include includes/fastcgi.conf;
}
}
server {
listen 80;
server_name geta6.net www.geta6.net;
rewrite ^ https://geta6.net$request_uri? permanent;
}
server {
listen 443;
server_name www.geta6.net;
rewrite ^ https://geta6.net$request_uri? permanent;
}
./configure \
--prefix=/usr/local \
--http-client-body-temp-path=/usr/local/tmp/nginx/client \
--http-proxy-temp-path=/usr/local/tmp/nginx/proxy \
--http-fastcgi-temp-path=/usr/local/tmp/nginx/fastcgi \
--conf-path=/usr/local/etc/nginx/nginx.conf \
--pid-path=/usr/local/var/run/nginx.pid \
--http-log-path=/usr/local/var/log/nginx/access.log \
--error-log-path=/usr/local/var/log/nginx/error.log \
--with-http_dav_module \
--with-http_mp4_module \
--with-http_secure_link_module \
--with-http_ssl_module \
--with-http_geoip_module \
--with-http_gzip_static_module \
--with-http_image_filter_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_xslt_module \
--with-mail \
--with-mail_ssl_module \
--without-http_uwsgi_module \
--without-http_scgi_module
#fastcgi_cache fpm-cache;
#fastcgi_cache_key $scheme$host$request_uri;
#fastcgi_cache_valid 200 304 60m;
#fastcgi_cache_min_uses 1;
#fastcgi_cache_use_stale error timeout invalid_header updating http_500;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
#proxy_cache nginx-cache;
#proxy_cache_valid 200 302 60m;
#proxy_cache_valid 404 1m;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Document-Root $document_root;
proxy_set_header X-Document-URI $document_uri;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
user www-data;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 70;
keepalive_requests 15;
sendfile on;
send_timeout 60;
msie_padding on;
msie_refresh off;
server_tokens off;
large_client_header_buffers 4 4k;
port_in_redirect on;
recursive_error_pages on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
server_name_in_redirect off;
client_max_body_size 4096M;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
map $scheme $php_https {
default off;
https on;
}
fastcgi_cache_path /usr/local/var/nginx/fastcgi levels=1:2 keys_zone=fpm-cache:1024m;
fastcgi_temp_path /usr/local/tmp/nginx/fastcgi;
proxy_cache_path /usr/local/var/nginx/proxy levels=1:2 keys_zone=nginx-cache:4m max_size=50m inactive=120m;
proxy_temp_path /usr/local/tmp/nginx/proxy;
# Default HTTP
server {
listen 80 default_server;
charset UTF-8;
server_name _;
error_page 404 /404.html;
location = /404.html {
root /var/www/defaults;
}
location / {
root /var/www/defaults;
index index.php index.html;
}
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include includes/fastcgi.conf;
}
}
# Default HTTPS
server {
listen 443 default_server;
server_name _;
root /var/www/defaults;
ssl on;
ssl_certificate certs/net.geta6.auth.crt;
ssl_certificate_key certs/net.geta6.auth.key;
location / {
index index.php index.html;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include includes/fastcgi.conf;
}
}
include configs/*.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment