VMware Images:
|
Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support On OpenSUSE 12.1
Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support On OpenSUSE 12.1Version 1.0 Nginx (pronounced "engine x") is a free, open-source, high-performance HTTP server. Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption. This tutorial shows how you can install Nginx on an OpenSUSE 12.1 server with PHP5 support (through PHP-FPM) and MySQL support. I do not issue any guarantee that this will work for you!
1 Preliminary NoteIn this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.
2 Installing MySQL 5First we install MySQL 5 like this: yast2 -i mysql mysql-client mysql-community-server Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server: systemctl enable mysql.service Now check that networking is enabled. Run netstat -tap | grep mysql It should show something like this: server1:~ # netstat -tap | grep mysql If it does not, edit /etc/my.cnf and comment out the option skip-networking: vi /etc/my.cnf
and restart your MySQL server: systemctl restart mysql.service (If you get the message You do not have a valid vim binary package installed. Please install either "vim", "vim-enhanced" or "gvim"., please run yast2 -i vim to install vi and try again. ) Run mysql_secure_installation to set a password for the user root (otherwise anybody can access your MySQL database!): server1:~ # mysql_secure_installation
3 Installing NginxNginx is available as a package for OpenSUSE 12.1 which we can install as follows: yast2 -i nginx-1.0 Then we create the system startup links for nginx and start it: systemctl enable nginx.service Type in your web server's IP address or hostname into a browser (e.g. http://192.168.0.100), and you should see the following page: You get a 403 forbidden error because on OpenSUSE 12.1, the default nginx document root is /srv/www/htdocs, and there's no index page in /srv/www/htdocs.
4 Installing PHP5We 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) which we install as follows: yast2 -i php5-fpm Before we start PHP-FPM, rename /etc/php5/fpm/php-fpm.conf.default to /etc/php5/fpm/php-fpm.conf: mv /etc/php5/fpm/php-fpm.conf.default /etc/php5/fpm/php-fpm.conf Change the permissions of PHP's session directory: chmod 1733 /var/lib/php5 Then open /etc/php5/fpm/php-fpm.conf... vi /etc/php5/fpm/php-fpm.conf ... and change error_log to /var/log/php-fpm.log and uncomment pm.min_spare_servers and pm.max_spare_servers:
Next create the system startup links for php-fpm and start it: systemctl enable php-fpm.service PHP-FPM is a daemon process that runs a FastCGI server on port 9000, as you can see in the output of netstat -tapn server1:~ # netstat -tapn
|





Recent comments
1 day 11 hours ago
1 day 13 hours ago
1 day 15 hours ago
1 day 16 hours ago
1 day 18 hours ago
1 day 19 hours ago
1 day 20 hours ago
2 days 12 hours ago
2 days 13 hours ago
2 days 17 hours ago