This commit is contained in:
54
webmail/nginx.conf
Normal file
54
webmail/nginx.conf
Normal file
@@ -0,0 +1,54 @@
|
||||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
# Serve the React SPA on the root path
|
||||
location / {
|
||||
root /var/www/html/spa;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Proxy /api requests to the backend container
|
||||
location /api/ {
|
||||
proxy_pass http://api: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;
|
||||
}
|
||||
|
||||
# Serve SnappyMail on /mail
|
||||
location ^~ /mail/ {
|
||||
alias /var/www/html/mail/;
|
||||
index index.php index.html;
|
||||
|
||||
# Need a specific regex for PHP files inside alias
|
||||
location ~ \.php$ {
|
||||
if (!-f $request_filename) {
|
||||
return 404;
|
||||
}
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
include fastcgi_params;
|
||||
}
|
||||
|
||||
# Deny access to SnappyMail data folder
|
||||
location ^~ /mail/data {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user