Jump to content

Nginx Compatibility


techhelper1

Recommended Posts

Hi again,

 

I was able to install 3.0b3 from the CLI just fine and I have not been able to access Blesta at all because of a redirect issue that uses the document path in the URL for some reason. Example (http://domain.tld/linux/path/to/blesta).

 

I tried converting the "stock" .htaccess rules and looked at https://github.com/cloudrck/blesta-nginx/blob/master/sites-available/blestav3, neither of them worked.

 

During this whole process I have been checking the error and access logs and it seems to be the index.php script doing the redirecting because Nginx is not doing it.

 

I do not want to use Apache2 because of the known vulnerabilities that it has and would rather use a high performance solution. I also do not want to setup a reverse proxy from Nginx to Apache2 since I don't see why it shouldn't work with any web server software.

 

Thanks

Link to comment
Share on other sites

Hi again,

 

I was able to install 3.0b3 from the CLI just fine and I have not been able to access Blesta at all because of a redirect issue that uses the document path in the URL for some reason. Example (http://domain.tld/linux/path/to/blesta).

 

I tried converting the "stock" .htaccess rules and looked at https://github.com/cloudrck/blesta-nginx/blob/master/sites-available/blestav3, neither of them worked.

 

During this whole process I have been checking the error and access logs and it seems to be the index.php script doing the redirecting because Nginx is not doing it.

 

I do not want to use Apache2 because of the known vulnerabilities that it has and would rather use a high performance solution. I also do not want to setup a reverse proxy from Nginx to Apache2 since I don't see why it shouldn't work with any web server software.

 

Thanks

I'm the one who put the config on githhub as I use Nginx only. I've not run into this issue, nor can I recreate it.

 

What is your OS, PHP version, are you running PHP-FPM? What does your config look like for that domain?

 

Do you use the stock Nginx configuration in addition to the domain config, or do you have other additional settings? Do you have cgi.pathinfo set in both the domain config and php.ini?

Link to comment
Share on other sites

Ubuntu, 5.4.6-1ubuntu1.2, yes

 

I censored some data so people don't go to it or learn anything about the directory structure.

 

The glitch I had was the define(htaccess) thing, that fixed it and Cody does not seem to realize that.

 

Config:

 

server {
        listen   (port and ssl options);
        #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6
 
        root (blesta folder);
        index index.php index.html index.htm;
 
        # Make site accessible from http://localhost/
        server_name (site name);
 
# Ported from Blesta's .htaccess
# There are more than one way to accomplish this.
# You can use try_files rather than using IF ... rewrite;
location / {
  error_page     404 = @blesta; #IF file doesn't exist
  log_not_found  off;
# For access to install file
if ($request_uri ~ "^(.*)/install.php$"){
    rewrite install.php /%1/install/ redirect;
  }
}
 
#Core rewrite
location @blesta {
  rewrite ^(.*)$ /index.php;
}
 
location ~ (\.pdt) {
return 403;
}
 
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                try_files $uri =404;
        #       fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_connect_timeout 60;
                fastcgi_send_timeout 180;
                fastcgi_read_timeout 180;
                # Buffer settings increase to compensate for increased time/size due to SSL
                fastcgi_buffer_size 128k;
                fastcgi_buffers 4 256k; #
                fastcgi_busy_buffers_size 256k;
                fastcgi_temp_file_write_size 256k;
                fastcgi_intercept_errors on;
        #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        #
        #       # With php5-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
 
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }
 
        # serve static files directly
        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
            expires           max;
        }
 
(ssl and log file stuff here)
}
Link to comment
Share on other sites

Because as of now it looks like a config issue rather than a problem with Blesta, I have deployed Blesta on several Nginx servers without issue. What does your fastcgi_params file look like? Assuming your fpm/php.ini is set correctly there should be no issues.

The glitch I had was the define(htaccess) thing, that fixed it and Cody does not seem to realize that.

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...