I installed ZenTao on Nginx. Is there a Nginx server configuration file?
2019-06-24 15:33:09
philip
  • Visits: 373
  • Join Date: 2018-10-18
  • Last Login: 2019-07-22

I installed ZenTao on Nginx. Is there a Nginx server configuration file?

2019-06-24 15:41:23
Yves
  • Visits: 1082
  • Join Date: 2016-08-02
  • Last Login: 2019-07-22
URL rewrite rules

if (!-d $request_filename){
set $rule_0 1$rule_0;
}
if (!-f $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite /(.*)$ /index.php/$1 last;
}

Default Nginx config file
server
{
    listen 80;
    server_name www.zentao.com;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/www.zentao.com/www;
    
    #SSL-START SSL config. Do not delete or change the following line which has 404 comment.
    #error_page 404/404.html;
    #SSL-END
    
    #ERROR-PAGE-START  Error page config. You can comment,delete or change it.
    error_page 404 /404.html;
    error_page 502 /502.html;
    #ERROR-PAGE-END
    
    #PHP-INFO-START  PHP reference config. You can comment or change it.
    include enable-php-70.conf;
    #PHP-INFO-END
    
    #REWRITE-START URL rewrite reference. Change it, then the URL rewrite will be invalid.
    include /www/server/panel/vhost/rewrite/www.zentao.com.conf;
    #REWRITE-END
    
    #File or directory is not allowed to visit.
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    
    #Directory configuration about SSL certificate verification.
    location ~ \.well-known{
        allow all;
    }
    
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log off;
        access_log off;
    }
    
    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log off;
        access_log off; 
    }
    access_log  /www/wwwlogs/www.zentao.com.log;
    error_log  /www/wwwlogs/www.zentao.com.error.log;

}


Complete ZenTao Nginx configuration after integrating all cnofig:
server
{
    listen 80;
    server_name www.zentao.com;
    index index.php index.html;
    root /www/wwwroot/www.zentao.com/www;
    
    #SSL-START SSL config. Do not delete or change the following line which has 404 comment.
    #error_page 404/404.html;
    #SSL-END
    
    #ERROR-PAGE-START  Error page config. You can comment,delete or change it.
    error_page 404 /404.html;
    error_page 502 /502.html;
    #ERROR-PAGE-END
    
        location ~ [^/]\.php(/|$)
        {
            try_files $uri =404;
            fastcgi_pass  unix:/tmp/php-cgi-70.sock;
            fastcgi_index index.php;
            include /www/server/nginx/conf/fastcgi.conf;# Enter your path here.
            set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") 
            {
                set $real_script_name $1;
                set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
        }

    
if (!-d $request_filename){
set $rule_0 1$rule_0;
}
if (!-f $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite /(.*)$ /index.php/$1 last;
}
    
    #File or directory is not allowed to visit.
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    
    #Directory configuration about SSL certificate verification.
    location ~ \.well-known{
        allow all;
    }
    
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log off;
        access_log off;
    }
    
    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log off;
        access_log off; 
    }
    access_log  /www/wwwlogs/www.zentao.com.log;
    error_log  /www/wwwlogs/www.zentao.com.error.log;

}
1/1
  • Contact Us

  • About Us
  • Email : Philip@easysoft.ltd
  • WhatsApp : 0086 18563953295
  • Skype : philip517