Install PHP 7, NGINX & MySQL 5.6 under CentOS/RHEL 7.1 & 6.7

888u

Last update at :2024-06-05,Edit by888u

Suitable for people who are mysophobic and value safety. It is generally recommended to use: OneinStack: self-service installation of lnmp, lamp, lnmpa, etc. (supports HHVM). CentOS 7 is recommended. All are under SSH and the root user.

1. Upgrade the system and change the update source for CentOS / RHEL 7 system

yum install epel-release rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm rpm -Uvh http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

Applicable to CentOS/RHEL 6 systems

yum install epel-release rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm rpm -Uvh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm

2. Install PHP 71, install PHP 7

yum install php70w

2. Install PHP 7 components and find components

yum search php70w

Install components

yum install php70w-mysql php70w-xml php70w-soap php70w-xmlrpc yum install php70w-mbstring php70w-json php70w-gd php70w-mcrypt

3. Install NGINX1, install NGINX

yum install nginx

2. Start NGINX

systemctl enable nginx.service systemctl start nginx.service

4. Install MySQL 5.61, install MySQL

yum install mysql-server

2. Security settings

systemctl start mysqld.service mysql_secure_installation

3. Start MySQL

systemctl restart mysqld.service systemctl enable mysqld.service

5. Set up PHP-FPM

yum install php70w-fpm

6. Create a website

nano /etc/nginx/conf.d/example.conf

Paste the following:

server { listen 80; root /var/www; index index.php index.html index.htm; server_name example.com www.example.com; location/{ try_files $uri $uri/ /index.html; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } location ~ .php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }

Change to your own domain name and file storage directory as needed.

7. Restart the service

systemctl restart nginx.service systemctl restart php-fpm.service

8. Firewall opens http (80) and https (443) ports

firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload

via: https://servercheap.net/crm/index.php?rp=/knowledgebase/1/Install-PHP-7-NGINX-and-MySQL-56-on-CentOSorRHEL-71-and-67. html

Recommended site searches: Baidu permanent high-performance server, web page registration, virtual host Hong Kong host, US imitation brand space, expired registered domain name, registered unregistered domain name, registration information, how to cancel domain name registration, US server, Space server,

Install PHP 7, NGINX & MySQL 5.6 under CentOS/RHEL 7.1 & 6.7

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码