VirtualBox Install CENTOS7 and configure the nginx PHP MySQL runtime environment

Source: Internet
Author: User
Tags fpm install php openssl php mysql iptables

VirtualBox Install CENTOS7 and configure the nginx PHP MySQL runtime environment one: VirtualBox install CENTOS7 and make Basic settings

1. Download the Dvd.iso installation file: https://www.centos.org/download/

I chose the Dvd.iso version, we have to query three different versions, for me the DVD version is enough, it is best to use thunder download, local download too slow

2. System (set)--boot sequence changed to CD drive floppy drive

3. Storage (settings), click Platters, select the. iso file that you downloaded earlier

4. Network settings for bridge mode, host and virtual machine can be interoperable

Introduction to several network modes: https://www.douban.com/group/topic/15558388/

5. Click Start to enter the system installation

6. Minimize installation, automatic partition of virtual hard disk, set root password

7. After successful installation, reboot

8. The simplest installed system does not exist the Ifconfig command, we install on the system

Yum provides ifconfig  or yum whatprovides ifconfig

The query to ifconfig command is dependent on the Net-tools software, so let's install the Net-tools software

Yum Install -y net-tools

Test to Ifconfig command can be used (previously can be replaced with the IP addr command)

9: initial wget Software Installation

Yum Install wget

10: Initial Install Killall command, Nginx and other services will be used when startup is off

Yum Install Psmisc

11: If necessary, you need to set up a static IP enable, later restart can always use this IP, due to my own company network configuration, I did not set.

vi/etc/sysconfig/network-scripts/ifcfg-**** file bootproto= "DHCP" modified to bootproto= "static" add: ipaddr=10.200.79.123 set static IP Address Restart Network Service: Service network restart and then because of the reason for setting up the static IP, the network connection is not the problem, resolved: The company network segment setup problem, resulting in the host and virtual machine is not the same network segment, but does not affect mutual access, Colleagues in the company can also access my virtual machine
Two: Build Nginx

Reference Address: 78541974

According to the article after installation, the process of starting Nginx encountered several problems

1.log_format main definition problem, error is as follows:
[Email protected] rewrite]#/selfdata/server/nginx-1.12.2/sbin/nginxnginx: [Emerg] Unknown log format "main" in/ Selfdata/server/nginx-1.12.2/nginx.conf:26

There is no definition for main in the above article, and Log_format definition is defined under Access_log using Main, change to

2. There is no issue with the log folder
[Email protected] rewrite]#/selfdata/server/nginx-1.12.2/sbin/nginxnginx: [Emerg] Open () "/selfdata/logs/nginx/ Access/default.log "failed (2:no such file or directory)

This is because:/selfdata/logs/nginx/folder under the Access folder does not exist, created, the reason why this folder is needed because the server configuration in Nginx conf/vhosts/ The address of this log is configured in the default.conf configuration file. Both the access and the error folders are created

The log directory does not exist in the 3.nginx program directory and needs to be created
[[email protected] nginx]#/selfdata/server/nginx-1.12.2/sbin/nginx[[email protected] nginx]# nginx: [Emerg] Open () "/ Selfdata/server/nginx-1.12.2/logs/nginx.pid "failed (2:no such file or directory)

Through the online query, you need to configure the Nginx program corresponding configuration file. and need to create the logs folder, the Nginx directory under the initialization of the installation when there is no such directory.

[Email protected] nginx-1.12. 2 mkdir Logs[[email protected] nginx-1.12. 2] #/selfdata/server/nginx-1.12. 2/sbin/nginx-c/selfdata/server/nginx-1.12. 2/nginx.conf
4. Then start, and show that 80 ports are occupied.
[Email protected] nginx-1.12.2]#/selfdata/server/nginx-1.12.2/sbin/nginxnginx: [Emerg] bind () to 0.0.0.0:80 failed (  98:address already in use) Nginx: [Emerg] bind () to 0.0.0.0:80 failed (98:address already on) Nginx: [Emerg] bind () to 0.0.0.0:80 failed (98:address already in use) Nginx: [Emerg] bind () to 0.0.0.0:80 failed (98:address already on use) Ngin x: [Emerg] bind () to 0.0.0.0:80 failed (98:address already on use) Nginx: [Emerg] still could not bind ()

  

I'll solve it in two steps.

First: Remove the effect of the firewall first, regardless of whether it has any effect. Reference Address: 71908529

~ ~ ~ To prevent the loss of the article, I'll copy it again:

Yum Install iptables-~~~]# systemctl enable Ip6tables.service

Enter Iptables to configure Port 80 because Nginx is accessed by 80 ports by default

VI /etc/sysconfig/iptables

Here is the configuration information:

# Generated by Iptables-save v1.4.21 on Fri may 21:28:29 2017*filter:input Accept [0:0]:forward Accept [0:0]:output ACC EPT [6:696]-a input-m State--state related,established-j accept-a input-p icmp-j accept-a input-i lo-j ACCEPT-A INP Ut-p tcp-m State--state new-m TCP--dport 22-j accept-a input-p tcp-m State--state new-m TCP--dport 21-j ACCEPT (The port that I configured for VSFTPD)-a input-p tcp-m state--state new-m TCP--dport 80-j ACCEPT (the port configured for Nginx, just enter the line)-a input-p tcp-m STA Te--state new-m tcp--dport 30000:30999-j accept-a input-j REJECT--reject-with icmp-host-prohibited-a forward-j REJE CT--reject-with icmp-host-prohibitedcommit# completed on Fri 12 21:28:29 2017

Then: Wq, Save the exit on the line;
Restart Iptables, the configuration will take effect;

[Email protected] ~]# systemctl restart Iptables.service

Turn on the firewall, whether you drive or not, and then open it again:

[Email protected] ~]# systemctl start FIREWALLD

Turn on HTTP access

[Email protected] ~]# firewall-cmd--permanent--add-service=http

Join Port 80

[Email protected] ~]# firewall-cmd--permanent--zone=trusted--add-port=

~ ~ ~ Finished Copy
And then it's an error.

Step Two:
[Email protected] nginx-1.12. 2 killall -9  nginx[[email protected] nginx-1.12.  2]#/selfdata/server/nginx-1.12. 2/sbin/nginx[[email protected] nginx-1.12.  2PS -ef| grep Nginx

Enabled successfully.

Add Nginx service and start the operation without practice success, open the process of error, so I did not add, first ignore this part

Three: Download and install PHP

Use the above article to refer to the installation failed, consult the data. Refer to another address: 72556781; This article is primarily reference to the Installation Components section, which requires these components to be supported before PHP is compiled and installed

I'll copy it down,

Yum-YInstallLIBXML2Yum-YInstalllibxml2-develYum-YInstallOpenSSLYum-YInstallopenssl-develYum-YInstallCurlYum-YInstallcurl-develYum-YInstallLibjpegYum-YInstalllibjpeg-develYum-YInstalllibpngYum-YInstalllibpng-develYum-YInstallFreeTypeYum-YInstallfreetype-develYum-YInstallPcreYum-YInstallpcre-develYum-YInstalllibxsltYum-YInstalllibxslt-develYum-YInstall bzip2Yum-YInstall bzip2-devel
#./configure--prefix=/selfdata/server/php-7.1. One--with-config-file-path=/selfdata/server/php-7.1. One/etc--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-jpeg-dir--with-xmlrpc--with-xsl--with-zlib--with-bz2--with-mhash--enable-fpm--enable-pdo--enable-bcmath--enable-libxml --enable-inline-optimization--enable-gd-native-ttf--enable-mbregex--enable-mbstring--enable-opcache-- Enable-pcntl--enable-shmop--enable-soap--enable-sockets--enable-sysvsem--enable-sysvshm--enable-xml--enable-Zip--enable-calendar# Make#  Make Install# CP/selfdata/package/php-7.1. One/php.ini-production/selfdata/server/php-7.1. One/etc/php.ini# CD/selfdata/server/php-7.1. One/etc#CPPhp-fpm.conf.default php-fpm.conf# CD/selfdata/server/php-7.1. One/etc/php-fpm.d#CPWww.conf.default www.conf#VI/selfdata/server/php-7.1. One/etc/php-fpm.conf~~Modify Content PID=/selfdata/server/php-7.1. One/var/run/php-Fpm.pid~~~End of Content #VI/selfdata/server/php-7.1. One/etc/php-fpm.d/www.conf~~~Content User=Wwwgroup=Wwwlisten=127.0.0.1:9000Pm.max_children= -pm.start_servers= -pm.min_spare_servers=5pm.max_spare_servers= *~ ~ ~ Content
Quad: MySQL Installation

MySQL first installation directly in accordance with the first resources installed, the direct folder installed, encountered a lot of errors, and finally always be reminded of the lack of PID files, and can not be enabled, and there is no error log, there is no way to choose the Uninstall, reinstall, re-install the use of Yum installed

1. Uninstall the original MySQL remnants, in the network query how to fully download

2.yum MySQL Installation reference:

Https://www.linuxidc.com/Linux/2016-09/135288.htm

3. The initial access settings are required after the installation is complete and the user sets these

Reference:

73196737
51802472

VirtualBox Install CENTOS7 and configure the nginx PHP MySQL runtime environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.