By Sam80
Hello
I have a lot of location routings inside my default Nginx default file. I decided to move some of them based on the application that use them in separate .conf files. The problem is that when I transfer locations to the separate files and include them info the default files nginx does not restart
Main file :
server {
# Enable HTTP/2
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name xxxx www.xxx;
ssl_certificate /etc/xxxx;
ssl_certificate_key /etc/xxx;
# Include the SSL configuration from cipherli.st
include snippets/ssl-params.conf;
include /etc/nginx/conf.d/*.conf;
location / {
xxxx
proxy_pass http://localhost:5000/;
xxxx
}
}
The sample.conf file
location /test/ {
xxxx
proxy_pass http://localhost:7000/
}
location /test2/ {
proxy_pass http://localhost:8000/;
}
location /sam/test3 {
return 301 /sam/test2/;
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
Whare is the sample.conf file located at?
I could suggest doing the following:
mkdir /etc/nginx/include
include include/*.conf;
If you are still seeing that issue, you could run an Nginx config test:
sudo nginx -t
Feel free to share the output of the config test here so I could try to advise you further.
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.