Skip to content

Instantly share code, notes, and snippets.

@gam-phon
Last active Dec 15, 2015
Embed
What would you like to do?
Sample Nginx configuration.
upstream app_servers {
server 127.0.0.1:8008;
}
server {
listen 80;
server_name www.yr.sa;
index index.html;
location = /favicon.ico {
access_log off;
log_not_found off;
}
# Static Files
# Use this or skip it to the another one.
location ~ /(static|media|js|css|img)/ {
# Prevent hotlinking
valid_referers none blocked yr.sa *.yr.sa;
if ($invalid_referer) {
return 403;
}
root /home/yaser/site_name/www;
expires 365d;
}
location /admin/ {
allow put_your_public_ip;
deny all;
proxy_pass http://app_servers;
proxy_read_timeout 90;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location / {
proxy_pass http://app_servers;
proxy_read_timeout 90;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# Using uwsgi
#location / {
# include uwsgi_params;
# uwsgi_pass unix:/project_path/project_name.sock;
#}
}
# Example of Redirect yr.sa to www.yr.sa
server {
listen 80;
server_name yr.sa;
rewrite ^ http://www.yr.sa$request_uri? permanent;
}
@moshohayeb

This comment has been minimized.

Copy link

@moshohayeb moshohayeb commented Apr 1, 2013

ahlaaaa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment