init testarena backend service
This commit is contained in:
58
asf-pc-server/testarena_pc_backend/nginx/testarena.conf
Normal file
58
asf-pc-server/testarena_pc_backend/nginx/testarena.conf
Normal file
@@ -0,0 +1,58 @@
|
||||
# TestArena Nginx Configuration
|
||||
# This file should be placed in /etc/nginx/sites-available/testarena
|
||||
# and symlinked to /etc/nginx/sites-enabled/testarena
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name _;
|
||||
|
||||
# Security: Prevent directory traversal and restrict symlinks
|
||||
disable_symlinks on;
|
||||
|
||||
# Root directory for the results (autoindex)
|
||||
location /results/ {
|
||||
alias /home/asf/testarena/;
|
||||
|
||||
# Enable autoindex with requested features
|
||||
autoindex on;
|
||||
autoindex_exact_size off; # Human-readable sizes
|
||||
autoindex_localtime on; # Local time
|
||||
|
||||
# Read-only access
|
||||
limit_except GET {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Prevent execution of scripts
|
||||
location ~* \.(php|pl|py|sh|cgi)$ {
|
||||
return 403;
|
||||
}
|
||||
}
|
||||
|
||||
# Proxy requests to the FastAPI application
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# WebSocket support (if needed in future)
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
# Custom error pages
|
||||
error_page 404 /404.html;
|
||||
location = /404.html {
|
||||
root /usr/share/nginx/html;
|
||||
internal;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
internal;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user