https://www.jb51.net/article/97754.htm
https://www.jb51.net/article/97754.htm
Native environment: The server is Ali cloud ECS; mirrors used are: public image CENTOS 7.2
Install a .nginx
1. Download nginx corresponding to the current version of the system package (package)
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2. The establishment of nginx yum repository (yum is not the default of nginx)
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
3. Download and install nginx
yum install nginx
4.nginx start (under nginx installation directory - / usr / sbin /)
systemctl start nginx.service
ps: nginx other related commands:
nginx configuration file:
The default configuration file in the / etc / nginx path, with this configuration has been run correctly Nginx;
The need to customize, and other documents to which modifications nginx.conf under;
Enter the machine's IP deployment environment nginx browser address bar, if all goes well, you should be able to see the contents of the following words.
Welcome to nginx!
If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.
For online documentation and support please refer tonginx.org.Commercial support is available atnginx.com.
Thank you for using nginx.
Step two: MYSQL installation
1. First download the repo source of mysql; related commands:
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2. Installation mysql-community-release-el7-5.noarch.rpm package
(After install the package, yum repo get two sources of mysql: /etc/yum.repos.d/mysql-community.repo,/etc/yum.repos.d/mysql-community-source.repo)
rpm -ivh mysql-community-release-el7-5.noarch.rpm
3. Install MYSQL
sudo yum install mysql-server
4. Reset Password
Change user permissions:
sudo chown -R root:root /var/lib/mysql
Restart the service:
systemctl restart mysql.service
Log in and change your password:
mysql -u root
mysql > use mysql;
mysql > updateusersetpassword=password(‘123456‘) whereuser=‘root‘;
mysql > exit;
Step 3: Install php
1. Check the currently installed php version (yum list installed | grep php)
If you remove the php version associated with yum remove php installation package before deleting the first package exists
2.rpm mounting Php7 respective source yum
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3. Install php7.1
This part of the tutorial did not follow the original article, but the use of a compiler installed PHP7.1
Step Four: Configure nginx
Remember to backup before modifying the configuration file
1.nginx profile location: (/ etc / nginx / conf.d / default.conf)
Modify the web root directory (if there is no demand can not modify, use the default):
root /wwwdata/html;
Php configuration parsing, modifying black enlarged portion following code:
location ~.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
2.php-fpm profile location: (/ etc / php-fpm.d / www.conf)
Modification
user =nginx
group=nginx
3. Start nginx services:
systemctl start nginx.service
To set the boot from the start with the following command:
sudo systemctl enable nginx.service
View startup state:
systemctl status nginx
See the following words illustrate the successful launch!
Active: active (running) since 六 2016-11-19 13:40:04 CST; 50min ago
4. Start PHP-FPM:
systemctl start php-fpm.service
To set the boot from Kai try the following command:
sudo systemctl enable php-fpm.service
View startup state:
systemctl status php-fpm.service
See the following words illustrate the successful launch!
Active: active (running) since 六 2016-11-19 14:14:33 CST; 18min ago
So far, php + mysql + nginx environment to build complete!
Finally, at the next test php file in the web root directory; whirring ~ ~
In order to facilitate access to modify the database, you need to install mysql management tool phpMyAdmin
Jump web root directory before setting the jump :( according to its own website root directory)
cd /wwwdata/html/
Pma download the installation package:
wget https://files.phpmyadmin.net/phpMyAdmin/4.4.12/phpMyAdmin-4.4.12-all-languages.zip
Extracting installation package:
unzip phpMyAdmin-4.4.12-all-languages.zip
If there is a lack unzip need to install unzip;
yum install unzip zip
Rename the installation folder
mv phpMyAdmin-4.4.12-all-languages phpmyadmin
Modify session storage directory permissions:
chown -R nginx.nginx /var/lib/php/session
If you need to modify the session you need to change the root location Location:
/etc/php.ini modify the session.save_path
Because /etc/php-fpm.d/www.conf of higher priority than session.save_path php.ini so if /etc/php-fpm.d/www.conf in the presence of just modify the session.save_path to
Access HTTP: // youipaddress / phpmyadin , if you can access on, you will be successful!
Thinking that it would be able to log on but has a problem! Not on the landing!
Do a little modification:
1. Modify the / var / lib / php / session folder permissions 770 or more
2. the modifications config.sample.inc.php phpmyadmin directory $ cfg'Servers '[' user '] =' root '; $ cfg'Servers' [ 'password'] = '123456'; as an own Username Password;