44 lines
1.6 KiB
Nginx Configuration File
44 lines
1.6 KiB
Nginx Configuration File
# - [x] Change port on nginx side
|
|
# - [x] Change port on application side
|
|
# - [x] Change domain
|
|
# - [ ] link_nginx subdomain.nunosempere.com
|
|
# - [ ] sudo nginx -t
|
|
# - [ ] sudo systemctl reload nginx
|
|
# - [ ] sudo certbot --nginx -d subdomain.nunosempere.com
|
|
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
|
|
server_name tweets.nunosempere.com;
|
|
|
|
location / {
|
|
# CORS headers
|
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
|
add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization' always;
|
|
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
|
|
|
# Handle preflight requests
|
|
if ($request_method = 'OPTIONS') {
|
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
|
add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization' always;
|
|
add_header 'Access-Control-Max-Age' 1728000;
|
|
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
|
add_header 'Content-Length' 0;
|
|
return 204;
|
|
}
|
|
|
|
proxy_pass http://localhost:3344;
|
|
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;
|
|
|
|
}
|
|
}
|
|
|