Problems with Nginx configuration file

BlackThorn

Verified User
Joined
Feb 24, 2013
Messages
34
Location
Istanbul
I have a dedicated server and there are around 100 websites. After moving from Apache to Nginx, I'm having a nginx.conf problem with each one of my sites. There is a nginx configuration file for all sites (/usr/local/directadmin/data/users/ACCOUNT/nginx.conf), as you know. Now let's say I would like to update the PHP version, or if you regenerate SSL again. After upgrade or regenerate, nginx.conf files resets for all sites. Why? How do I make this stop? Meanwhile I'm adding nginx URL rewrites manually and I don't know if it could be the problem. Can you help me out with that?
 
DA templated system, it regenerates confs at each modification.
you must copy templates to /custom directory and modify them as you need, it will apply them for all domains.
if you want custom modifications for single domain - you can do them via DA panel "Custom HTTPD" menu.
 

Attachments

  • 676657567.png
    676657567.png
    31.1 KB · Views: 14
Thank you very much! But would you tell me is this really going to work?

Code:
    location /
    {
        try_files $uri $uri/ /index.php?$args;
    }
    location = /robots.txt
    {
        allow all;
        log_not_found off;
        access_log off;
    }
    location ~* \.(js|css|ttf|ttc|otf|eot|woff|woff2|png|jpg|jpeg|gif|ico)$
    {
        expires 1y;
        log_not_found off;
        add_header Cache-Control "public,max-age=31536000,immutable";
    }

DA -> Custom HTTPD -> Domain name -> Customise -> Which one? There are a few section but where will we put all this? And also, is these rewrites correct or not? I am asking because I read that should be like that:

Code:
|*if !SUB|
location / {
    try_files $uri $uri/ /index.php?$args;
}
|*endif|

I'm so confused...
 
Last edited:
@Zhenyapan It was just an example. Otherwise, Httpd and Nginx.conf pages are same in DA panel.

Edit: I think I've solved that problem.

To solve put these rewrite rules into CUSTOM or CUSTOM3 section.
 
Last edited:
Back
Top