Skip to content

Instantly share code, notes, and snippets.

log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server {
listen 80 default_server;
listen [::]:80 default_server;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
@binghuiyin
binghuiyin / gist:2288fe48f05f273cb8ea240ec7609f76
Created November 15, 2019 06:31
Nginx conf file example for HTTP
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server {
listen 80;
server_name mysite.com;
access_log /var/log/nginx/host.access.log main;
root /home/davidyin/mysite.com;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server {
listen 80 default_server;
listen [::]:80 default_server;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
@binghuiyin
binghuiyin / whovpn.conf
Last active August 12, 2017 09:21
nginx with ssl sample
# HTTP site redirect to HTTPS
server {
listen 80 ;
server_name whovpn.com www.whovpn.com;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://whovpn.com$request_uri;
}