Hi,
I am trying to use nginx + apache to deploy a Strapi application.
In the Strapi instructions for nginx proxying, it says I need to setup an upstream block:
And then this Nginx Virtual Host:
However when I try to put the Proxy Config in CUSTOM2 (or the other options) in CUSTOM HTTPD CONFIGURATIONS, it just says there's a duplicate location block or a different error.
This is driving me crazy because normally I'd just modify the entire nginx config without these templates, but if I do that they just get overwritten every time I make a change in DirectAdmin.
I am trying to use nginx + apache to deploy a Strapi application.
In the Strapi instructions for nginx proxying, it says I need to setup an upstream block:
Code:
# path: /etc/nginx/conf.d/upstream.conf
# Strapi server
upstream strapi {
server 127.0.0.1:1337;
}
And then this Nginx Virtual Host:
Code:
# path: /etc/nginx/sites-available/strapi.conf
server {
# Listen HTTP
listen 80;
server_name api.example.com;
# Redirect HTTP to HTTPS
return 301 https://$host$request_uri;
}
server {
# Listen HTTPS
listen 443 ssl;
server_name api.example.com;
# SSL config
ssl_certificate /path/to/your/certificate/file;
ssl_certificate_key /path/to/your/certificate/key;
# Proxy Config
location / {
proxy_pass http://strapi;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $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;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass_request_headers on;
}
}
However when I try to put the Proxy Config in CUSTOM2 (or the other options) in CUSTOM HTTPD CONFIGURATIONS, it just says there's a duplicate location block or a different error.
This is driving me crazy because normally I'd just modify the entire nginx config without these templates, but if I do that they just get overwritten every time I make a change in DirectAdmin.