ISPConfig: replace apache with nginx

from here
In this tutorial i show you how to replace apache with nginx using ISPConfig 3.0.5.4. I performed the migration for serveral sites running Joomla 2.x, Joomla 3.x, WordPress and some static / self-written pages.The server runs ISPConfig 3.0.5.4.p6 installed using the Perfect Server Howto from howtoforge.com.

There are some differents between apache and nginx so you may have to adjust some settings for your web-sites.
nginx does not support .htaccess
nginx does not use different apache-modules like mod_rewrite

You can use different online-converters like www.anilcetin.com to move the configs from apache to nginx. But keep in mind, that it´s not guranteed, that the convert works with out any errors. I used for different (very simple) htaccess without any problems

If you change the webserver in ISPConfig from apache to nginx, you can´t see your additional apache directives in the interface (but they are still in the database). You can browse through all you websites and write down the directives or you can grab them from the databse using phpmyadmin or mysql with this sql-command:
SELECT domain, apache_directives FROM web_domain WHERE apache_directives != '';

To find all .htaccess files, you ran run find /var/www/clients/ -name .htaccess -not -path "*/stats/*".

1. install nginx
apt-get install nginx

2. install php-fpm
apt-get install php5-fpm
and make sure, that /etc/php5/fpm/php.ini contains:

cgi.fix_pathinfo=0
date.timezone=”Europe/Berlin”

Restart php-fpm with /etc/init.d/php5-fpm reload.

Now nginx is installed but apache is still your active webserver.

3. enable Maintaince mode
Enable the Maintenance Mode in ISPConfig under System / Mainconfig on the tab Misc to prevent changes during the migration.

4. switch to nginx in ISPConfig
Login as root into phpmyadmin, open the database dbispconfig, select the table server and edit the server.

Scroll down to config and find the line [global] finden. In the next line replace

webserver=apache

with

webserver=nginx

Scroll futher down to the line [web] And change the next line from

server_type=apache

to

server_type=nginx

nginx03

6. Create ispconfig.vhost in /etc/nginx/sites-available:
vi /etc/nginx/sites-avaliable/ispconfig.vhost
and paste one of the following contents:

with SSL:

server {
listen 8080;
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt
ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key;
server_name _;

root /usr/local/ispconfig/interface/web/;

client_max_body_size 20M;

location / {
index index.php index.html;
}

# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
access_log off;
}

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/ispconfig.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}

location ~ /\. {
deny all;
}
}

without SSL:

server {
listen 8080;
ssl off;
server_name _;

root /usr/local/ispconfig/interface/web/;

client_max_body_size 20M;

location / {
index index.php index.html;
}

# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
access_log off;
}

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/ispconfig.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}

location ~ /\. {
deny all;
}
}

And create the symlink with
ln -s /etc/nginx/sites-available/ispconfig.vhost /etc/nginx/sites-enabled/000-ispconfig.vhost

7. adjust websites
Disable the Maintaince Mode and convert existing htaccess-file and apache-directives and insert the new values in the webinterface for each website.

If you did not change all websites, run the resyn-tool for the websites.

8. disable apache and start nginx
/etc/init.d/apache2 stop
update-rc.d -f apache2 remove
/etc/init.d/nginx start

Done

If you need to switch-back to apache, just revert the steps 4. and 8.

ISPConfig: replace apache with nginx

This Article from here

In this tutorial i show you how to replace apache with nginx using ISPConfig 3.0.5.4. I performed the migration for serveral sites running Joomla 2.x, Joomla 3.x, WordPress and some static / self-written pages.

The server runs ISPConfig 3.0.5.4.p6 installed using the Perfect Server Howto from howtoforge.com.

There are some differents between apache and nginx so you may have to adjust some settings for your web-sites.
nginx does not support .htaccess
nginx does not use different apache-modules like mod_rewrite

You can use different online-converters like www.anilcetin.com to move the configs from apache to nginx. But keep in mind, that it´s not guranteed, that the convert works with out any errors. I used for different (very simple) htaccess without any problems

If you change the webserver in ISPConfig from apache to nginx, you can´t see your additional apache directives in the interface (but they are still in the database). You can browse through all you websites and write down the directives or you can grab them from the databse using phpmyadmin or mysql with this sql-command:
SELECT domain, apache_directives FROM web_domain WHERE apache_directives != '';

To find all .htaccess files, you ran run find /var/www/clients/ -name .htaccess -not -path "*/stats/*".

1. install nginx
apt-get install nginx

2. install php-fpm
apt-get install php5-fpm
and make sure, that /etc/php5/fpm/php.ini contains:

cgi.fix_pathinfo=0
date.timezone=”Europe/Berlin”

Restart php-fpm with /etc/init.d/php5-fpm reload.

Now nginx is installed but apache is still your active webserver.

3. enable Maintaince mode
Enable the Maintenance Mode in ISPConfig under System / Mainconfig on the tab Misc to prevent changes during the migration.

4. switch to nginx in ISPConfig
Login as root into phpmyadmin, open the database dbispconfig, select the table server and edit the server.

Scroll down to config and find the line [global] finden. In the next line replace

webserver=apache

with

webserver=nginx

Scroll futher down to the line [web] And change the next line from

server_type=apache

to

server_type=nginx

6. Create ispconfig.vhost in /etc/nginx/sites-available:
vi /etc/nginx/sites-avaliable/ispconfig.vhost
and paste one of the following contents:

with SSL:

server {
listen 8080;
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /usr/local/ispconfig/interface/ssl/ispserver.crt
ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key;
server_name _;

root /usr/local/ispconfig/interface/web/;

client_max_body_size 20M;

location / {
index index.php index.html;
}

# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
access_log off;
}

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/ispconfig.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}

location ~ /\. {
deny all;
}
}

without SSL:

server {
listen 8080;
ssl off;
server_name _;

root /usr/local/ispconfig/interface/web/;

client_max_body_size 20M;

location / {
index index.php index.html;
}

# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
access_log off;
}

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/ispconfig.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}

location ~ /\. {
deny all;
}
}

And create the symlink with
ln -s /etc/nginx/sites-available/ispconfig.vhost /etc/nginx/sites-enabled/000-ispconfig.vhost

7. adjust websites
Disable the Maintaince Mode and convert existing htaccess-file and apache-directives and insert the new values in the webinterface for each website.

If you did not change all websites, run the resyn-tool for the websites.

8. disable apache and start nginx
/etc/init.d/apache2 stop
update-rc.d -f apache2 remove
/etc/init.d/nginx start

Done

If you need to switch-back to apache, just revert the steps 4. and 8.

Install Soap for ISPConfig Centos 7 for Roundcubemail

Look up the following inside your script file

phpinfo();

If you can’t find Soap Client set to enabled like so: the way soap should appear in phpinfo()

run for Webstatic repository to install if it’s not present

yum install php70w-soap 

Do the following:

  1. Locate php.ini in your apache bin folder, I.e /etc/php.ini
  2. Remove the ; from the beginning of extension=php_soap.so it is present
  3. Restart your Apache server
  4. Look up your phpinfo(); again and check if you see a similar picture to the one above
  5. If you do, problem solved!

To use soap for this roundcube plugin

Assuming you have already installed Roundcube and ISPConfig 3, follow the instructions below. If not, please download and install Roundcube from http://www.roundcube.net/ and ISPConfig 3 from http://www.ispconfig.org/.

Step 1

  • Make sure you are using the latest stable ISPConfig.
  • Make sure you are using the latest stable Roundcube.
  • Read the requirements: Requirements

Step 2

Go to your ISPConfig panel and add a new remote user: Tab “System” > “Remote Users”

Tick the checkbox Remote Access and activate the following functions:

  • Client functions
  • Server functions
  • Mail user functions
  • Mail user filter functions
  • Mail alias functions
  • Mail forward functions
  • Mail fetchmail functions
  • Mail spamfilter user functions
  • Mail spamfilter policy functions
  • Mail spamfilter whitelist functions
  • Mail spamfilter blacklist functions

Step 3

Download the latest plugin package for Roundcube. You can either install the files from a ZIP archive or use a version management system, such as Git or Subversion (SVN). Using Git or SVN seems favorable since they feature commands to easily update the plugin package.

As a starting point for any variant, make sure you are located in the Roundcube root directory before executing the listed commands. Also, make sure not to miss the trailing ‘.’ (period) when copying the commands. It causes the plugin folders to be fetched to the current directory (and omits the creation of an undesired extra folder).

Install via Git

cd plugins
git clone https://github.com/w2c/ispconfig3_roundcube.git .

Update via Git

cd plugins
git pull origin master

Install via Subversion (SVN)

cd plugins
svn co https://github.com/w2c/ispconfig3_roundcube/trunk/ .

Update via Subversion (SVN)

cd plugins
svn up .

Install from archive

Download the most recent version from: https://github.com/w2c/ispconfig3_roundcube/archive/master.zip
Extract the content of the ispconfig3_roundcube-master folder in the ZIP file to the pluginsdirectory of your Roundcube installation.

Step 4

Copy the file ./ispconfig3_account/config/config.inc.php.dist to ./ispconfig3_account/config/config.inc.php.

Step 5

In the newly created config file (./ispconfig3_account/config/config.inc.php) replace the sample values with your individual settings:

$config['identity_limit'] = false;
$config['remote_soap_user'] = '{REMOTE USERNAME}';
$config['remote_soap_pass'] = '{REMOTE PASSWORD}';
$config['soap_url'] = 'https://{YOUR SERVER}:8080/remote/';
$config['soap_validate_cert'] = true;

Change the port (set to “8080” by default) if necessary. If your ISPConfig installation is using a self-signed server certificate (= not issued by a public CA, such as Letsencrypt), you might have to set soap_validate_cert to false. Otherwise, if the certificate is not trusted, you will see the error message “Soap Error: Could not connect to host“.

For example, if your username is “Santa”, your password is “Claus”, your server’s domain is “christmas.com” (or you can use an IP address). If your ISPConfig panel can be accessed via port 1111 and you are using TLS with a trusted certificate, your configuration would be:

$config['identity_limit'] = false;
$config['remote_soap_user'] = 'Santa';
$config['remote_soap_pass'] = 'Claus';
$config['soap_url'] = 'https://christmas.com:1111/remote/';
$config['soap_validate_cert'] = true;

Step 6

In the config file of Roundcube look for this line:

// List of active plugins (in plugins/ directory)
$config['plugins'] = array();

If there are already plugins listed, add the following to the array:

, "jqueryui", "ispconfig3_account", "ispconfig3_autoreply", "ispconfig3_autoselect", "ispconfig3_pass", "ispconfig3_spam", "ispconfig3_fetchmail", "ispconfig3_filter", "ispconfig3_forward", "ispconfig3_wblist"

!! The jqueryui plugin has to be listed prior to the ISPConfig3 plugins !! !! If you are just using one server for mail, do not activate the autoselect plugin !!

Otherwise, if there are no plugins yet, replace the line with the following:

// List of active plugins (in plugins/ directory)
$config['plugins'] = array("jqueryui", "ispconfig3_account", "ispconfig3_autoreply", "ispconfig3_autoselect", "ispconfig3_pass", "ispconfig3_spam", "ispconfig3_fetchmail", "ispconfig3_filter", "ispconfig3_forward", "ispconfig3_wblist");

Any plugins you want to be inactive, have to be removed from this line. For instance, if you do not wish to have “ispconfig3_pass” (password changer) enabled, you have to omit it. The entire line would then look like this:

// List of active plugins (in plugins/ directory)
$config['plugins'] = array("jqueryui", "ispconfig3_account", "ispconfig3_autoreply", "ispconfig3_autoselect", "ispconfig3_spam", "ispconfig3_fetchmail", "ispconfig3_filter", "ispconfig3_forward", "ispconfig3_wblist");

Step 7

A new tab named “Accounts” should now be visible on your settings page in Roundcube, displaying all plugins enabled in step 6.

PS: If you encounter any issue, look here: Troubleshooting / FAQ

Clone this wiki locally