Skip to content

Instantly share code, notes, and snippets.

@minakolta
Last active December 17, 2015 20:48
Show Gist options
  • Save minakolta/5670154 to your computer and use it in GitHub Desktop.
Save minakolta/5670154 to your computer and use it in GitHub Desktop.
Apache config for nginx - sample
upstream yourdomain {
server 127.0.0.1:8080; #static IP or 127.0.0.1 And Apache port
}
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name yourdomain.com;
server_name_in_redirect off;
location / {
root /var/www/yourdomain.com;
index index.html index.htm index.php;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto http;
proxy_set_header Host $host;
proxy_pass http://yourdomain;
rewrite ^([^.]*[^/])$ $1/ permanent;
set $dest $http_destination;
if ($http_destination ~ "^http://(.+)") {
set $dest http://$1;
}
proxy_set_header Destination $dest;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment