Nginx is a free, open-source, and high-performance HTTP server. Nginx features stability, rich functional modules, simple configuration, and low resource consumption. This tutorial demonstrates how to install the ngixn server of PHP5 (via PHP-FPM module) + MySQL on Fedora15. I cannot guarantee that your machine will definitely work! 1. Preliminary Description: In this tutorial, the default
Nginx is a free, open-source, and high-performance HTTP server. Nginx features stability, rich functional modules, simple configuration, and low resource consumption. This tutorial demonstrates howEdInstalled on ora 15PHP5 (through the PHP-FPM module) + ngixn server of MySQL.
I cannot guarantee that your machine will definitely work!
1. Preliminary description:
In this tutorial, the default IP address is 192.168.0.100 and the host name is server1.ExAmple.com. These settings may be different from your server, so you must change the IP address and host name of your computer.
2. First install mysql, enter the followingCommand.
yum install mysql mysql-server
Then configure MYSQL to start automatically with the computer:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
Check whether the network is enabled. Run the following command:
netstat -tap | grep mysql
The following information is displayed, indicating that the network is running successfully:
[root@server1 ~]# netstat -tap | grep mysqltcp 0 0 *:mysql *:* LISTEN 1517/mysqld[root@server1 ~]#
If the above information is not fed back, you need to edit the/etc/my. cnf file:
vi /etc/my.cnf
Comment the following information:
#skip-networking
Then restart Mysql:
/etc/init.d/mysqld restart
mysql_secure_installation
Set the root password:
[Root @ server1 ~] # Mysql_secure_installation
NOTE: running all parts of this script is recommended for all MySQL
Servers in production use! Please read each step carefully!
In order to log into MySQL to secure it, we'll need the current
Password for the root user. If you 've just installed MySQL, and
You haven'tSetThe root password yet, the password will be blank,
So you shoshould just press enter here.
Enter current password for root (enter for none ):
OK,SuCcessfully uSedPassword, moving on...
Setting the root password ensures that nobody can log into the MySQL
Root user without the proper authorisation.
Set root password? [Y/n]
New password:
Re-enter new password:
Password upDateD successfully!
Reloading privilege tables ..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
To log into MySQL without having to have a user account created
Them. This is intended only for testing, and to make the installation
Go a bit smoother. You shoshould remove them before moving into
ProDuCtion environment.
Remove anonymous users? [Y/n]
... Success!
NoRmAlly, root shoshould only be allowed to connect from 'localhost'. This
Ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n]
... Success!
By default, MySQL comes with a database named 'test' that anyone can
Access. This is also intended only for testing, and shocould be removed
Before moving into a production environment.
Remove test database and access to it? [Y/n]
-DropPingTest database...
... Success!
-Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
Will take effect immediately.
Reload privilege tables now? [Y/n]
... Success!
Cleaning up...
All done! If you 've completed all of the above steps, your MySQL
Installation shoshould now be secure.
Thanks for using MySQL!
[Root @ server1 ~] #
3. Install Nginx
yum install nginx
Create and start with the system:
chkconfig --levels 235 nginx on
/etc/init.d/nginx start
Then check whether Nginx works. Enter the IP address in the browser,
Nginxwebsite
4. install PHP:
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
Then configure PHP:
vi /etc/php.ini
Refer to the following Configuration:
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting; of zero causes PHP to behave as before. Default is 1. You should fix your scripts; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.; http://www.php.net/manual/en/ini.core.php#ini.cgi.fix-pathinfocgi.fix_pathinfo=0
You can also refer to the official Nginx wiki configuration instructions: http://wiki.nginx.org/Pitfalls
Next create the PHP-FPM system boot link and start it:
chkconfig --levels 235 php-fpm on
/etc/init.d/php-fpm start