VMware Images:
|
The Perfect Server - CentOS 6.1 x86_64 With nginx [ISPConfig 3] - Page 5
15 Install Nginx, PHP5 (PHP-FPM), And FcgiwrapNginx is available as a package for CentOS 6.1 (from EPEL) which we can install as follows: yum install nginx If Apache2 is already installed on the system, stop it now... /etc/init.d/httpd stop ... and remove Apache's system startup links: chkconfig --del httpd Then we create the system startup links for nginx and start it: chkconfig --levels 235 nginx on (If both Apache2 and nginx are installed, the ISPConfig 3 installer will ask you which one you want to use - answer nginx in this case. If only one of these both is installed, ISPConfig will do the necessary configuration automatically.) We can make PHP5 work in nginx through PHP-FPM (PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites). We can install php-fpm together with php-cli and some PHP5 modules like php-mysql which you need if you want to use MySQL from your PHP scripts as follows: yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy Next we open /etc/php.ini... vi /etc/php.ini ... and change the error reporting (so that notices aren't shown any longer) and uncomment cgi.fix_pathinfo=1:
Also set cgi.fix_pathinfo=0: vi /etc/php.ini
(Please read http://wiki.nginx.org/Pitfalls to find out why you should do this.) In addition to that, in order to avoid errors like [08-Aug-2011 18:07:08] PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /usr/share/nginx/html/info.php on line 2 ... in /var/log/php-fpm/www-error.log when you call a PHP script in your browser, you should set date.timezone in /etc/php.ini:
You can find out the correct timezone for your system by running: cat /etc/sysconfig/clock [root@server1 tmp]# cat /etc/sysconfig/clock Next create the system startup links for php-fpm and start it: chkconfig --levels 235 php-fpm on PHP-FPM is a daemon process (with the init script /etc/init.d/php-fpm) that runs a FastCGI server on port 9000. To get CGI support in nginx, we install Fcgiwrap. Fcgiwrap is a CGI wrapper that should work also for complex CGI scripts and can be used for shared hosting environments because it allows each vhost to use its own cgi-bin directory. As there's no fcgiwrap package for CentOS 6.1, we must build it ourselves. First we install some prerequisites: yum install fcgi-devel Now we can build fcgiwrap as follows: cd /usr/local/src/ This installs fcgiwrap to /usr/local/sbin/fcgiwrap. Next we install the spawn-fcgi package which allows us to run fcgiwrap as a daemon: yum install spawn-fcgi Open /etc/sysconfig/spawn-fcgi... vi /etc/sysconfig/spawn-fcgi ... and modify the file as follows:
Now add the user nginx to the group apache: usermod -a -G apache nginx Create the system startup links for spawn-fcgi... chkconfig --levels 235 spawn-fcgi on ... and start it as follows: /etc/init.d/spawn-fcgi start You should now find the fcgiwrap socket in/var/run/fcgiwrap.socket, owned by the user and group apache (some scripts, e.g. Mailman, expect to be run by the user/group apache, that's why we don't run spawn-fcgi as user/group nginx, but instead add nginx to the apache group).
16 Install phpMyAdminNext we install phpMyAdmin: yum install phpmyadmin Next we change the authentication in phpMyAdmin from cookie to http: vi /usr/share/phpmyadmin/config.inc.php
You can now find phpMyAdmin in the /usr/share/phpmyadmin/ directory. After you have installed ISPConfig 3, you can access phpMyAdmin as follows: The ISPConfig apps vhost on port 8081 for nginx comes with a phpMyAdmin configuration, so you can use http://server1.example.com:8081/phpmyadmin or http://server1.example.com:8081/phpMyAdmin to access phpMyAdmin. If you want to use a /phpmyadmin or /phpMyAdmin alias that you can use from your web sites, this is a bit more complicated than for Apache because nginx does not have global aliases (i.e., aliases that can be defined for all vhosts). Therefore you have to define these aliases for each vhost from which you want to access phpMyAdmin. To do this, paste the following into the nginx Directives field on the Options tab of the web site in ISPConfig:
If you use https instead of http for your vhost, you should add the line fastcgi_param HTTPS on; to your phpMyAdmin configuration like this:
If you use both http and https for your vhost, you need to add the following section to the http {} section in /etc/nginx/nginx.conf (before any include lines) which determines if the visitor uses http or https and sets the $fastcgi_https variable (which we will use in our phpMyAdmin configuration) accordingly: vi /etc/nginx/nginx.conf
Don't forget to reload nginx afterwards: /etc/init.d/nginx reload Then go to the nginx Directives field again, and instead of fastcgi_param HTTPS on; you add the line fastcgi_param HTTPS $fastcgi_https; so that you can use phpMyAdmin for both http and https requests:
17 Install MailmanSince version 3.0.4, ISPConfig also allows you to manage (create/modify/delete) Mailman mailing lists. If you want to make use of this feature, install Mailman as follows: yum install mailman Before we can start Mailman, a first mailing list called mailman must be created: /usr/lib/mailman/bin/newlist mailman [root@server1 tmp]# /usr/lib/mailman/bin/newlist mailman Open /etc/aliases afterwards... vi /etc/aliases ... and add the following lines:
Run newaliases afterwards and restart Postfix: /etc/init.d/postfix restart Create the system startup links for Mailman and start it: chkconfig --levels 235 mailman on Now we need to create this symlink to make Mailman work with ISPConfig: cd /usr/lib/mailman/cgi-bin/ If you want to use Mailman from your web sites created through ISPConfig, this is a bit more complicated than for Apache because nginx does not have global aliases (i.e., aliases that can be defined for all vhosts). Therefore you have to define these aliases for each vhost from which you want to access Mailman. To do this, paste the following into the nginx Directives field on the Options tab of the web site in ISPConfig:
This defines the alias /cgi-bin/mailman/ for your vhost, which means you can access the Mailman admin interface for a list at http://<vhost>/cgi-bin/mailman/admin/<listname>, and the web page for users of a mailing list can be found at http://<vhost>/cgi-bin/mailman/listinfo/<listname>. Under http://<vhost>/pipermail you can find the mailing list archives.
|



Recent comments
2 hours 55 min ago
12 hours 23 min ago
13 hours 13 min ago
16 hours 46 min ago
21 hours 10 min ago
21 hours 32 min ago
23 hours 41 min ago
1 day 9 hours ago
1 day 14 hours ago
1 day 16 hours ago