Store Community Support Documentation
spirog

HI, I thought this might come in handy for anyone looking to use Short URL's with Nginx on PLesk Control Panel

( this is only for someone wanting to run FPM application served by Nginx )

my setup is CentOS 7 with PLesk Obsidian Control Panel

in PLesk there is setting to add additional nginx directives, it's located under > Apache & Nginx Settings.

Additional nginx directives

Here you can specify the settings for the nginx reverse proxy server that runs in front of Apache. Your directives will override the server-wide nginx configuration. For example, you may want to change the connection timeout or to pack requests with gzip. Use the same syntax as you use for nginx.conf. For example, if you want to pack all the proxied requests with gzip, add the line: 'gzip_proxied any;'.

Additional nginx directives

I added this rewrite code below and now its working ( I have Snapshots of the settings below also, and where you add the rewrite code for short url's to work with Nginx for phpFox in PLesk control Panel . It's working great with phpFox version 4.7.8 and should be backward compatible to work with version 4.6.0 and up

 
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
location / {
rewrite ^/file/(.*) /PF.Base/file/$1 last;
rewrite ^/static/ajax.php /index.php last;
rewrite ^/themes/default/(.*) /PF.Base/theme/default/$1 last;
rewrite ^/(static|theme|module)/(.*) /PF.Base/$1/$2 last;
rewrite ^/(Apps|themes)/(.*) /PF.Site/$1/$2 last;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /PF.Base/file/log {
deny all;
return 404;
}

 

Here are my photos so you can see how the settings look in PLesk - last photo is where I've added the rewrite code and got short URL's working on mysite :)

 

 

 

Capture4.PNGCapture3.PNGCapture2.PNGCapture1.PNGCapture.PNG

Capture1

 

Capture2

 

Capture3

 

 

Capture4

 

Capture


The last Photo is where I added the rewrite code for phpFox to work with Nginx in Plesk

Click Apply and your all Done. 

then go back to AdminCP and click on Short URL's. 

if it says can't read .htaccess file, you need to manually turn on this feature 

FTP to your public_html folder and open the file 

PF.Base / file / settings / server.sett.php

and look for 
$_CONF['core.url_rewrite'] = '2'; 

and replace that with 
$_CONF['core.url_rewrite'] = '1';

By setting this to "1" this will transform your sites URLs from (example's below): 
https://www.yoursite.com/index.php?do=/blog
to 
https://www.yoursite.com/blog

Save and close the file.

You should now have short url's enabled on your site. 

Hope this Helps someone who may require to run phpFox Short URLS with Nginx on Plesk Control Panel

 

Warm Regards,

 

Spiro G

Last update on October 29, 6:09 am by spirog.