plane/nginx/nginx.conf

50 lines
1.5 KiB
Nginx Configuration File
Raw Normal View History

upstream plane {
server localhost:80;
}
2023-03-06 21:04:13 +00:00
events {
worker_connections 1024;
}
worker_processes 1;
2023-03-06 20:37:59 +00:00
error_log /var/log/nginx/error.log;
server_tokens off;
access_log /var/log/nginx/access.log;
2023-03-06 21:04:13 +00:00
http {
sendfile on;
upstream django {
2023-03-06 21:14:15 +00:00
server planebackend:8000;
2023-03-06 21:04:13 +00:00
}
upstream react {
2023-03-06 21:14:15 +00:00
server planefrontend:3000;
2023-03-06 21:04:13 +00:00
}
server {
listen 80;
root /www/data/;
access_log /var/log/nginx/access.log;
location / {
proxy_pass http://planefrontend:3000/;
proxy_set_header Host $host;
2023-03-08 06:37:07 +00:00
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
location /api/ {
proxy_pass http://planebackend:8000/api/;
proxy_set_header Host $host;
2023-03-06 21:11:28 +00:00
proxy_set_header Content-Type application/json;
2023-03-08 06:37:07 +00:00
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
2023-03-06 21:04:13 +00:00
}