Jump to content
  • 0

Blesta + nginx + php-fpm + php 7


1edo

Question

Hi,

I'm testing blesta 3 and 4 beta 4 with nginx, php 7.0 and php-fpm, works well but for some reason, in url appears https://midomain.com/index.php instead https://midomain.com/ this produce long url

example https://midomain.com/index.php/client/login/

# 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 last; 
}

source: https://github.com/cloudrck/blesta-nginx/blob/master/sites-available/blestav3

Someone configured it to be this way?

Thanks!

Rgds,

Edo

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I am running blesta-4.0.0-b4 as root in a dev environment (debian/nginx/php7.0-fpm) and I use this for the root location section:

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

and my urls come out as:  http://blesta.mydomain.local/admin/settings/company/modules/manage/10

 

Hope that helps.

Link to comment
Share on other sites

  • 0
10 hours ago, Hogie said:

I am running blesta-4.0.0-b4 as root in a dev environment (debian/nginx/php7.0-fpm) and I use this for the root location section:


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

and my urls come out as:  http://blesta.mydomain.local/admin/settings/company/modules/manage/10

 

Hope that helps.

Wow! Thanks, Works great.

Link to comment
Share on other sites

  • 0
10 hours ago, Hogie said:

I am running blesta-4.0.0-b4 as root in a dev environment (debian/nginx/php7.0-fpm) and I use this for the root location section:


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

and my urls come out as:  http://blesta.mydomain.local/admin/settings/company/modules/manage/10

 

Hope that helps.

I guess I should also throw out what is going on with it...

 

try_files is a fast way to do an if statement if the files exist.  First, it will try to see if that path exists as a file ($uri), then see if it is a directory ($uri/)  then it will internally redirect it to run as index.php?fullpath which is what the url was doing with index.php in it, but we are just making it go away.  You can add other things too, and this is MUCH faster than if statements in the location section.  If you can get away with it, never use if statements in the nginx configuration where it will be parsed for every connection.  It would slow it down to apache levels ;)

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
Answer this question...

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