Plesk 10 nginx reverse proxy configuration in front of Apache

Plesk 10 nginx reverse proxy configuration

On older Plesk version (

websrvmng –set-http-port –port=8080

Starting with Plesk 10 this is not so easy since you have to edit a php file called /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php. In my case instead of :

domain->physicalHosting->ipAddress->address ?>:server->webserver->httpsPort : $VAR->server->webserver->httpPort ?>>
ServerName "domain->asciiName ?>:server->webserver->httpsPort : $VAR->server->webserver->httpPort ?>"

I’ve set :


<VirtualHost <?php echo $OPT[‘ipAddress’]->escapedAddress ?>:<?php echo $OPT[‘ssl’] ? 8043 : 8080 ?>>
ServerName “<?php echo $VAR->domain->asciiName ?>:<?php echo $OPT[‘ssl’] ? 8043 : 8080 ?>”

Where 8043 will be the new https port and 8080 will be the http port.

After this change I had to run :

/usr/local/psa/admin/bin/httpdmng –reconfigure-all

Note that this is only for Plesk 10.x. On 9.x we used to have

/usr/local/psa/admin/sbin/websrvmng –reconfigure-all

After this make sure that the Apache server has set in its configuration files (/etc/httpd/conf/httpd.conf) Listen 8080 instead of Listen 80. Same thing for the /etc/httpd/conf.d/ssl.conf file, Listen 8043 instead of Listen 443.

Then you need to install nginx (yum install nginx) and download this zip file that these guys provided Furthermore you can check their

Once downloaded run:


Verify with “nginx -t” that there isn’t any error and finally restart the involved services :

service httpd restart
service nginx restart

Make sure that 8043 and 8080 accept connections. (Note that its not necessary to change the https port).

Using mod_proxy in Plesk to redirect to a different site


Site1 :
Site2 :

The idea is to make a proxy redirect so if I access to be redirected to and keep the URL in the browser.
This can be done either by using mod_rewrite (if both sites are on the same server) or by using mod_proxy. In my case I had to do this on a Plesk server.

I’ve created in /var/www/vhosts/ a file called vhost.conf that contains:

ProxyRequests off
Order deny,allow
Allow from all

ProxyPass /shop
ProxyPassReverse /shop
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1

Order allow,deny
Allow from all

Then I ran:

/usr/local/psa/admin/bin/websrvmng -a -v

Verify httpd.include to see if there is any Include directive.

Now if you go to you should be redirected to Notice the trailing slash after (../shop/). That needs to be there otherwise it won’t load the images properly.

This can be fixed by adding in vhost.conf a Rewrite rule like:
RewriteEngine on
RewriteRule ^/shop$ /shop/ [R]

Bulk adding domains in Plesk

I had one client that wanted to add 400 domains on 4 Windows servers, each server had like 4-5 public ips, so I had to use 4/5 ip for 100 domains.

On Windows this worked fine for me:

FOR /L %i IN (0,1,99) DO domain –create mydomain61%i.INFO -login user61%i -ip IP_address -status enabled -hosting true -hst_type phys -passwd domainpass -cgi true -php true -dns true -template Default_Domain

Note that you have to add your own template and rename it like Default_Domain. Of course you can script this even more by taking the domains from a list, same for the ip addresses.

On Linux this can be done using the script.

Install FFmpeg and FFmpeg-php on Centos 5 and Plesk

Run :

rpm -Uhv
yum -y install ffmpeg ffmpeg-devel mplayer mencoder flvtool2
cd /usr/src
tar jxvf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0
make install

Edit /etc/php.ini and add :

and then:

service httpd restart

Plesk Qmail issue regarding /etc/courier-imap/shared/index

If you see in your logs:
Jun 4 16:11:18 host imapd: /etc/courier-imap/shared/index: No such file or directory

you need to check perms and ownership on /var/qmail/bin/qmail-queue

# ls -la /var/qmail/bin/qmail-queue
-r-s–x–x 1 root qmail 25828 Apr 26 15:20 /var/qmail/bin/qmail-queue
perms are fine, but ownership is not
# chown qmailq:qmail /var/qmail/bin/qmail-queue
# ls -la /var/qmail/bin/qmail-queue
-r-x–x–x 1 qmailq qmail 25828 Apr 26 15:20 /var/qmail/bin/qmail-queue
[root@host ~]# service qmail restart
Stopping : Starting qmail: