Skip to content

Instantly share code, notes, and snippets.

@Robinzon100
Created August 31, 2020 13:35
Show Gist options
  • Save Robinzon100/b460f73ef0149e584111ee287d243388 to your computer and use it in GitHub Desktop.
Save Robinzon100/b460f73ef0149e584111ee287d243388 to your computer and use it in GitHub Desktop.
server {
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name crop2shop.ge www.crop2shop.ge;
#server_name _;
location / {
add_header 'Access-Control-Allow-Origin' 'https://crop2shop.ge';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
proxy_pass http://localhost:3000; #whatever port your app runs on
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /api/{
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
#proxy_pass http://localhost:5000/$1$is_args$args;
proxy_pass http://localhost:5000;
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 5000;
#
# server_name crop2shop.ge www.crop2shop.ge;
#
# root /var/www/html;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/crop2shop.ge/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/crop2shop.ge/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.crop2shop.ge) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = crop2shop.ge) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name crop2shop.ge www.crop2shop.ge;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment