Install LNMP and phpMyAdmin under CentOS6.5

 
As a web server: Compared with Apache, Nginx uses less resources, supports more concurrent connections, and is more efficient.
As a load balancing server: Nginx can directly support Rails and PHP internally, and can also support external services as an HTTP proxy server.
As a mail proxy server: Nginx is also a very good mail proxy server (one of the first purposes of developing this product was also as a mail proxy server), Last/fm describes a successful and wonderful experience using it.
Nginx installation is very simple, and the configuration file is very concise (it also supports perl syntax). Nginx supports smooth loading of new configurations, and can also upgrade software versions without interruption of service.

 

The architecture of LNMP is therefore very popular, especially the emergence of VPS and cloud hosting, which further promotes the development and integration of the architecture of LNMP, which has natively supported the php-fpm method since php5.4. PHP-FPM is a PHP FastCGI manager. It is no longer a third-party package. PHP-FPM provides a better PHP process management method, which can effectively control memory and processes, and can smoothly reload PHP configuration, which is better than spawn-fcgi. has more advantages.

 

1. Before installation, turn off the firewall and clean up the installed packages:

chkconfig iptables off
rpm -e httpd
rpm -e mysql
rpm -e php
yum -y remove httpd
yum -y remove mysql
yum -y remove php #Search

apache package
rpm -qa http* #Force

uninstall apache package
rpm -e --nodeps Query the file name #Check

whether to uninstall cleanly
rpm -qa|grep http*

 

2. Configure CentOS 6.0 third-party yum source (there is no nginx package in the default standard source of CentOS)

wget http://www.atomicorp.com/installers/atomic
sh ./atomic
yum check-update

 

3. Install the development package and library files

yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel

 

4. Install Nginx

yum install nginx
service nginx start
chkconfig --levels 235 nginx on #Set 2, 3, 5 levels to start

 

5. Install Mysql

yum install mysql mysql-server mysql-devel
service mysqld start
chkconfig --levels 235 mysqld on #After
installation, the default user name is root and the password is empty #Change
root password
mysqladmin -uroot password 666666 -p

 

6. Install php

yum install php php-devel 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-pdo php-devel php-common php-curl

 

7.安装FastCGI(FPM)

yum install php-fpm
service php-fpm start
chkconfig --levels 235 php-fpm on

 

8.配置Nginx支持php

vim /etc/nginx/conf.d/default.conf
#1.将“location /”处增加php的扩展
#2.将“location ~ \.php$”解除注释,并修改成以下那样。

location / {
            root /usr/share/nginx/html;
            index index.php index.html index.htm;
}

location ~ \.php$ {
            root /usr/share/nginx/html;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
}

 9.配置php

vim /etc/php.ini
cgi.fix_pathinfo = 1 #将注释去掉,开启PHP的pathinfo伪静态功能。
max_execution_time = 0  #脚本运行的最长时间,默认30秒
max_input_time = 300 #脚本可以消耗的时间,默认60秒
memory_limit = 256M #脚本运行最大消耗的内存,根据你的需求更改数值,默认128M
post_max_size = 100M  #单提交的最大数据,此项不是限制上传单个文件的大小,而是针对整个表单的提交数据进行限制的。限制范围包括表单提交的所有内容.例如:发表贴子时,贴子标题,内容,附件等…默认8M
upload_max_filesize = 10M #上载文件的最大许可大小 ,默认2M

 

10.安装phpmyadmin

#到https://www.phpmyadmin.net/downloads/下载对应版本,我下载的是支持php5.3以上的版本。

cd /usr/share/nginx/html/
wget https://files.phpmyadmin.net/phpMyAdmin/4.4.15.5/phpMyAdmin-4.4.15.5-all-languages.zip
unzip phpMyAdmin-4.4.15.5-all-languages.zip
mv phpMyAdmin-4.4.15.5-all-languages zhaonimei

 

10.重启Nginx php-fpm

service nginx restart
service php-fpm restart

 

11.测试Nginx是否解析php

本地浏览器输入:192.168.1.105/zhaonimei
显示phpmyadmin登录界面 环境搭建成功

 

参考文章:

http://www.centoscn.com/CentosServer/www/2015/0422/5245.html

http://www.cnblogs.com/xiaoit/p/3991037.html

Nginx和Apache伪静态配置参考

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326875925&siteId=291194637