Jump to content

Blesta + Nginx On VestaCP


JNdev

Recommended Posts

Hi

I write blesta configuration with nginx webserver on the control panel VESTACP.

I follow great tutorial @ServZoo but fastcgi not work on vestacp

 

Add to your config locate /home/username/conf/web

######################################################################
 location / {
        error_page     404 = @blesta; #IF file doesn't exist
        log_not_found  off;
        
        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9007;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
        }
    }
    #Core rewrite
    location @blesta {
        rewrite ^(.*)$ /index.php last;
#       rewrite ^(.*)$ /index.php/(.*) /$1  permanent;
    }

# Disallow access to any file with .pdt extension
location ~ (\.pdt) {
    return 403;
}

if (!-e $request_filename){
rewrite ^(.*)$ /index.php;
}

#Core rewrite
location @blesta {
        rewrite ^(.*)$/index.php/(.*) /$1  permanent;
}
######################################################################

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------

Sample Config:

 

server {
    listen      123.123.123.123:443;
    server_name sub.domain.com www.sub.domain.com;
    root        /home/admin/web/sub.domain.com/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/sub.domain.com.log combined;
    access_log  /var/log/nginx/domains/sub.domain.com.bytes bytes;
    error_log   /var/log/nginx/domains/sub.domain.com.error.log error;



######################################################################
 location / {
        error_page     404 = @blesta; #IF file doesn't exist
        log_not_found  off;
		
		location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9007;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
        }
    }
    #Core rewrite
    location @blesta {
        rewrite ^(.*)$ /index.php last;
#       rewrite ^(.*)$ /index.php/(.*) /$1  permanent;
    }

# Disallow access to any file with .pdt extension
location ~ (\.pdt) {
    return 403;
}

if (!-e $request_filename){
rewrite ^(.*)$ /index.php;
}

#Core rewrite
location @blesta {
        rewrite ^(.*)$/index.php/(.*) /$1  permanent;
}
######################################################################


    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /etc/nginx/conf.d/webmail.inc*;

    include     /home/admin/conf/web/nginx.sub.domain.com.conf*;
}

 

------------------------------

Open file lib/init.php

Search: define("HTACCESS", file_exists(ROOTWEBDIR . ".htaccess"));

Replace with: define("HTACCESS", true);

 

---------------------------

Note:

1. listen      123.123.123.123:80 / 443  ==> Replace  123.123.123.123 with your ip server/vps.

2. fastcgi_pass    127.0.0.1:9007 change 9007 with original port after creating domain.

 

We are sorry if the tutorial is already there, I search not found for nginx vestacp so I write here as well as my documentation. :D

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...