Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of configuring LNMP Environment in CentOS6.7 system

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Today, the editor will share with you the relevant knowledge points about the method of configuring the LNMP environment in the CentOS6.7 system. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

1: view the environment:

[root@localhost ~] # cat / etc/redhat-release

2: turn off the firewall

# effective after restart [root@localhost ~] # chkconfig iptables offor# takes effect immediately, failure to enable [root@localhost ~] # service iptables stop after restart

Close selinux

# effective immediately, invalidate after restart [root@localhost ~] # setenforce 0 / / modify selinux=enforcing to disabled and then restart to take effect [root@localhost ~] # vi / etc/selinux/config

3. Configure centos 6.7third-party yum source (there is no nginx package in the centos default standard source)

[root@localhost ~] # wget http://www.atomicorp.com/installers/atomic [root@localhost ~] # sh. / atomic [root@localhost ~] # yum check-update

4: install the development package and library files

The copy code is as follows:

# be careful not to change lines

[root@localhost ~] # 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

5: uninstall installed apache, mysql, php

# yum remove httpd# yum remove mysql# yum remove php

6: install nginx

# yum install nginx# service nginx start# chkconfig-- levels 235 nginx on / / Boot at levels 2, 3 and 5

7: install mysql

# yum install mysql mysql-server mysql-devel# service mysqld start# chkconfig-- levels 235 mysqld on// login to mysql to delete empty users, and change the root password mysql > select user,host,password from mysql.user; mysql > drop user''@ localhost; mysql > update mysql.user set password = password ('your password') where user='root'; mysql > flush privileges

8: install php

/ / also be careful not to break lines # yum install php 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// install php and required components to make php support mysql, fastcgi mode # yum install php-tidy php-common php-devel php-fpm php-mysql# service php-fpm start# chkconfig-- levels 235 php-fpm on

9: configure nginx to support php

/ / change the configuration file to a backup file # mv / etc/nginx/nginx.conf/ etc/nginx/nginx.confbak// since the original configuration file has to be written by yourself, you can use the default configuration file as the configuration file # cp / etc/nginx/nginx.conf.default / etc/nginx/nginx.conf// modify the server section of the nginx configuration file, add fastcgi support # vi / etc/nginx/nginx.conf// to join the index.phpindex index.php index.html index.htm / / uncomment the following code and modify it to the nginx default path location ~\ .php$ {root html; fastcgi_pass 127.0.0.1 php$ 9000; fastcgi_index index.php; fastcgi_param script_filename / usr/share/nginx/html$fastcgi_script_name; include fastcgi_params;}

10: configure php

/ / Edit the file php.ini, and add cgi.fix_pathinfo = 1 [root@centos ~] # vi / etc/php.ini at the end of the file

11: restart nginx php-fpm

# service nginx restart# service php-fpm restart

12: create the info.php file

# vi / usr/share/nginx/html/info.php

13: test whether nginx can parse php

Local browser input: 192.168.32.164/info.php

These are all the contents of the article "how to configure the LNMP environment in the CentOS6.7 system". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report