change location of subdomain with proxy

drstreet

Verified User
Joined
Jul 8, 2015
Messages
8
hello,

i want know how can i change location in admin->custom httpd -> domain

in section CUSTOM2 i add :


Code:
|*if !SUB|

location / {
                try_files $uri $uri/ /index.php?$query_string;
        }

|*endif|

|*if SUB="play"|

location / {
        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;
        proxy_pass              http://127.0.0.1:8000;
        proxy_read_timeout      90;
        proxy_redirect          http://127.0.0.1:8000 http://sub.domain.com;
    }
}
      
|*endif|
and build rewrite confs. but code's not add in my user account /usr/local/directadmin/data/users/MYUSER/nginx.conf

there is my USER/nginx.conf content :
Code:
server                                                                                                                                               
{                                                                                                                                                    
        listen 1.1.1.1:80;                                                                                                                      
        server_name domain.com www.domain.com ;                                                                                                    
        access_log /var/log/nginx/domains/domain.com.log;                                                                                           
        access_log /var/log/nginx/domains/domain.com.bytes bytes;                                                                                   
        error_log /var/log/nginx/domains/domain.com.error.log;                                                                                      
        root /home/domain/domains/domain.com/video/public;                                                                                       
        index index.php index.html index.htm;                                                                                                        
        include /usr/local/directadmin/data/users/MYUSER/nginx_php.conf;                                                                          
        include /etc/nginx/webapps.conf;                                                                                                             
}       

server                                                                                                                                               
{                                                                                                                                                    
        listen 1.1.1.1:443 ssl http2;                                                                                                           
        server_name sub.domain.com www.sub.domain.com ;                                                                                          
        access_log /var/log/nginx/domains/domain.com.sub.log;                                                                                      
        access_log /var/log/nginx/domains/domain.com.sub.bytes bytes;                                                                              
        error_log /var/log/nginx/domains/domain.com.sub.error.log;                                                                                 
        root /home/domain/domains/domain.com/private_html/sub;                                                                                  
        index index.php index.html index.htm;                                                                                                        
        ssl_certificate /etc/nginx/ssl.crt/server.crt.combined;                                                                                      
        ssl_certificate_key /etc/nginx/ssl.key/server.key;                                                                                           
        include /usr/local/directadmin/data/users/domain/nginx_php.conf;                                                                          
        include /etc/nginx/webapps.ssl.conf;                                                                                                         
}

any idea?
 
Last edited:

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,889
Location
GMT +7.00
Hello,

For nginx installed by directadmin there is another page, a link can be found in a list of domains.
 

drstreet

Verified User
Joined
Jul 8, 2015
Messages
8
my bad ! i had syntax error in my code :) i added one more }
i add the code in first section and work like charm !
 
Top