Install Nginx + PHP5 + MySQL in CentOS5.6

Source: Internet
Author: User
Nginx is a web server software developed by Russian developers. It features fast operation speed, low memory usage, and low CPU consumption. It quickly occupies a place in the web server market, now nginx has set up a specialized company. In this tutorial, use the host name www.baidu.org.tw and the IP address 192.168.0.100. These settings may

Nginx is a web server software developed by Russian developers.It features fast operation speed, low memory usage, and low CPU consumption. It quickly occupies a place in the web server market. Now nginx has set up a specialized company.

In this tutorial, use the host name www. baIdU.org.tw, IP address 192.168.0.100. These settings may be different, so you must replace them as appropriate.

First install MySQL 5, enterCommand:
yum install mysql mysql-server
Set automatic start of MYSQL at startup
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

Check whether the network is enabled. Run
netstat -tap | grep mysql
If it runs normally, the following information should be displayed:

Root@www.linuxidc.com ~ #Netstat-Tap | grep mysql
TCp0 0 *: mysql *: * LISTEN 2479/mysqld
Root@www.linuxidc.com ~ #

If not, edit the/etc/my. cnf file and comment out the option to skip the network:
vi /etc/my.cnf

# Skip-networking

And restart your MySQL Server:
/etc/init.d/mysqld restart
Then run the code to set the MySQL account password
mysql_secure_installation
Root@www.linuxidc.com ~ # 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 neEdThe 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@www.linuxidc.com ~ #

For Nginx installation, enter the following command for preparation before installation:
cd /etc/yum.repos.d/
wget http://centos.karan.org/kbsingh-CentOS-Extras.repo

Configuration file:
vi /etc/yum.repos.d/kbsingh-CentOS-Extras.repo
The modification content is as follows:

# Pkgs in the-Testing repo are not gpg signed
[Kbs-CentOS-Testing]
Name = CentOS. Karan. Org-EL $ releasever? Testing
Gpgcheck = 0
Gpgkey = http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
EnableD = 1
Baseurl = http://centos.karan.org/el#releasever/ExTras/testing/$ basearch/RPMS/

Then, we can install nginx as follows:
yum install nginx
Then, create the system to start nginx and start it:

chkconfig --levels 235 nginx on
/etc/init.d/nginx start

Enter your Web server IP address or host name (for example, http: // 192.168.0.100) in the browser. You should see a blank page, note that the website has been working on this blank Homepage Address (/usr/share/nginx/html/index.html, you can modify it by yourself ):

InstallPHP5
yum install lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy
Open/etc/php. ini and configure cgi. fix_pathinfo = 1:
vi /etc/php.ini

Cgi. fix_pathinfo = 1

The executable file/usr/bin/spawn-fcgi attached to the FastCGI package of lighttpd can be seen for help:
spawn-fcgi --help

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.