In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how to install and configure nginx mysql php". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Nginx mysql php installation and configuration methods: 1, download Nginx and install start nginx;2, extract "php-7.2.25.tar.gz" and install php required dependencies; 3, change the nginx configuration file; 4, install mysql and start the service.
This article operating environment: centos7 system, php version 7.2.25, DELL G3 computer
How does nginx mysql php install the configuration?
Installation and configuration of nginx and PHP mysql under CentOS7:
Download Nginx
The first dependency package installed is:
Gcc automake autoconf libtool make gcc gcc-c++ openssl openssl-devel
Wget http://zlib.net/zlib-1.2.11.tar.gz
Wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
1. Create a new folder / home/soft/ on the server
2.cd / home/soft/ = > execute the command to download Nginx wget http://nginx.org/download/nginx-1.7.4.tar.gz
Wget http://cn2.php.net/distributions/php-7.0.0.tar.gz
3. Extract the downloaded package to / opt/software/ = > tar-zvxf nginx-1.7.4.tar.gz-C / opt/software/
4.cd / opt/software/nginx-1.7.4/ = >. / configure-- prefix=/usr/local/nginx/
5.make & & make install
6. Start nginx = > / usr/local/nginx/sbin/nginx
7. Open a browser to access the IP of this machine, if the browser appears Welcome to nginx! Indicates that Nginx is installed and running successfully.
8. Restart: / usr/local/nginx/sbin/nginx-s reload
Stop: / usr/local/nginx/sbin/nginx-s stop
Test whether the configuration file is normal: / usr/local/nginx/sbin/nginx-t
Force shutdown: pkill nginx
Download php
1. Cd / home/soft/ download php:wget https://www.php.net/distributions/php-7.2.25.tar.gz
two。 Decompress php-7.2.25.tar.gz = > tar-zvxf php-7.2.25.tar.gz-C / opt/software/
3. Cd / opt/software/php-7.2.25/
4. Install the dependencies required by php first:
Yum update yum-y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel yum-y install curl-devel yum-y install libxslt-devel yum install openssl openssl-devel
5.
/ configure-- prefix=/usr/local/php-- with-curl-- with-freetype-dir-- with-gd-- with-gettext-- with-iconv-dir-- with-kerberos-- with-libdir=lib64-- with-libxml-dir-- with-mysqli-- with-openssl-- with-pcre-regex-- with-pdo-mysql-- with-pdo-sqlite-- with-pear-- with-png-dir-- with -xmlrpc-- with-xsl-- with-zlib-- enable-fpm-- enable-bcmath-- enable-libxml-- enable-gd-native-ttf-- enable-mbregex-- enable-mbstring-- enable-opcache-- enable-pcntl-- enable-shmop-- enable-soap-- enable-sockets-- enable-sysvsem-- enable-xml-- enable-zip
6. Make & & make install
7. Php for configuration information:
Cp / opt/software/php-7.2.25/php.ini-development / usr/local/php/lib/php.ini cp / usr/local/php/etc/php-fpm.conf.default / usr/local/php/etc/php-fpm.conf cp / usr/local/php/etc/php-fpm.d/www.conf.default / usr/local/php/etc/php-fpm.d/www.conf cp-R / opt/software / php-7.2.25/sapi/fpm/php-fpm / etc/init.d/php-fpm * need to pay attention to the information such as the port number of the configuration file www.conf in php7 to configure phpfpm. If you change the default 9000 port number, you need to change it here, and then change the configuration of nginx.
Ngin parses php:
1. Change the configuration file of nginx = > vim / usr/local/nginx/etc/nginx/nginx.conf
Location ~\ .php$ {root / usr/share/nginx/html; # specifies the root directory of php fastcgi_pass 127.0.0.1 usr/share/nginx/html; 9000; the default port for # php-fpm is 9000 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # path include fastcgi_params;}
2.php configuration Boot self-boot:
Vim / usr/lib/systemd/system/php-fpm.service [Unit] Description=php After=network.target [Service] Type=forking ExecStart=/usr/local/php/sbin/php-fpm ExecStop=/bin/pkill-9 php-fpm PrivateTmp=true [Install] WantedBy=multi-user.target
3. Killall / etc/init.d/php-fpm
4. Start php
Systemctl restart php-fpm.service systemctl enable php-fpm.service
Install mysql
Add yum Feed
Download the source installation package first and enter wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Next to install, type yum localinstall mysql57-community-release-el7-11.noarch.rpm. After execution, let's see if the installation is successful.
Yum install and start the service
All right, next up is yum-y install mysql-community-server.
Enter systemctl start mysqld to start the service
Finally, enter systemctl enable mysqld to add boot and start automatically. At this point, MySQL has been successfully installed.
Change the default password
Use grep 'temporary password' / var/log/mysqld.log to view the default password. Then mysql-u root-p enter the default password found to log in to MySQL
Enter ALTER USER 'root'@'localhost' IDENTIFIED BY' youPassword'; to change the password. Note that MySQL 5.7requires passwords to contain uppercase and lowercase letters, numbers and special characters.
Open a remote connection
Enter GRANT ALL PRIVILEGES ON *. * TO 'username'@'%' IDENTIFIED BY' password' WITH GRANT OPTION; in MySQL. Open the port after the addition is completed
This is the end of the content of "how to install nginx mysql php configuration". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.