Skip to content

Instantly share code, notes, and snippets.

@rankun203
Last active January 8, 2017 13:27
Show Gist options
  • Save rankun203/db1425ade887ddf021dbdd3edcf592d9 to your computer and use it in GitHub Desktop.
Save rankun203/db1425ade887ddf021dbdd3edcf592d9 to your computer and use it in GitHub Desktop.
Script to help you start a nginx at current folder
server {
listen 443 ssl;
ssl_certificate /etc/nginx/certs/certs.crt;
ssl_certificate_key /etc/nginx/certs/certs.key;
# Workaround to Upgrade-Insecure-Requests:1 issue...
if ($scheme = https) {
return 301 http://$host$request_uri;
}
location / {
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 Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 15M;
proxy_redirect off;
proxy_buffers 64 4k;
proxy_pass http://wp:80/;
}
}
#!/usr/bin/env bash
docker run -it -p 1978:80 --name web -v "${1}":/usr/share/nginx/html nginx && docker rm web
# Run the nginx: nx `pwd`
# To enable file indices.
# docker exec -it web bash
echo "autoindex on;" > /etc/nginx/conf.d/index.conf && service nginx reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment