Nginx check whether the yum source has nginx
yum list nginx
Since the official source does not have nginx, we need to find it by ourselves. This is the other system I am looking for. Please check the http://wiki.nginx.org/Install.
[nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=0enabled=1
$ Releasever is your centos version. My centos6.3, so yes.
Http://nginx.org/packages/centos/6/?basearch/
Run the following command and copy the above Code
vi /etc/yum.repos.d/nginx.repo
yum install nginx
In this way, the installation is complete.
Start nginx
/etc/init.d/nginx start
View Processes
ps -ef | grep nginx
You can enter an IP address for access through a browser (note that the firewall is off)
PHP
yum list php php-fpm
yum install php php-fpm
Start PHP-FPM
/etc/init.d/php-fpm start
PHP and nginx normally do not overlap. here we need to change the nginx configuration file to enable FastCGI
vim /etc/nginx/conf.d/default.conf
Remove comments from the green block. to modify the two red blocks in the green block, use the above as the root directory of the website.
Restart nginx
/etc/init.d/nginx restart
Create a phpinfo. php Write File under/usr/share/nginx/html
<?php phpinfo(); ?>
Access it from the browser.
You can also directly access it using PHP.
php /urs/share/nginx/html/phpinfo.php
----------------------- PHP-fpmphp and nginx normally there is no intersection of the interaction protocol to process the interaction between PHP and nginx FastCGI protocol when nginx processes PHP files, it is passed to the FastCGI parser of PHP through the FastCGI protocol, the fast-CGI parser executes the request and returns the generated content to nginx. nginx sends the content to the user's browser, PHP-FPM, parses the fast-CGI protocol, and calls the CGI parser of PHP, fastCGI Process Manager is the FastCGI Process Manager of PHP. ----------------------- MySQL
yum list mysql mysql-server
yum install mysql mysql-server
mysql_install_db
// Initialize the script and create your own system database MySql in MySQL
Mysqld_safe & // background startup
Enter MySQL (note that your password is blank now)
mysql -uroot
MySQL extension is not installed by default for PHP installed in yum.
Yum list PHP-mysql // PHP install MySQL extension
All installed now
PHP, MySQL, and nginx Status Management
/etc/init.d/nginx stop/etc/init.d/nginx start/etc/init.d/nginx restart/etc/init.d/mysqld stop/etc/init.d/mysqld start/etc/init.d/mysqld restart/etc/init.d/php-fpm start/etc/init.d/php-fpm restart/etc/init.d/php-fpm stop
Install the lamp environment yum in centos