In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Source: https://blog.csdn.net/Powerful_Fy
Php official website: https://www.php.net
After entering the official website, click downloads to select the version you need to download.
This paper takes php version 7.3.10 as an example.
Installation package storage path / usr/local/src/
Download:
[root@linux src] # wget https://www.php.net/distributions/php-7.3.10.tar.bz2
Decompress:
[root@linux src] # tar-jxvf php-7.3.10.tar.bz2
Compile and install:
Enter the directory cd php-7.3.10.tar.bz2
Configure compilation parameters:
. / configure-- prefix=/usr/local/php-fpm-- with-config-file-path=/usr/local/php-fpm/etc-- enable-fpm-- with-fpm-user=php-fpm-- with-fpm-group=php-fpm-- with-mysql=/usr/local/mysql-- with-mysqli=/usr/local/mysql/bin/mysql_config-- with-pdo-mysql=/usr/local/mysql-- with-mysql-sock=/tmp/mysql.sock-- with-libxml-dir-- with -gd--with-jpeg-dir-- with-png-dir-- with-freetype-dir-- with-iconv-dir-- with-zlib-dir-- with-mcrypt-- enable-soap-- enable-gd-native-ttf-- enable-ftp-- enable-mbstring-- enable-exif-- with-pear-- with-curl-- with-openssl
Compilation: make
Installation: make install
Copy the configuration file php.ini-development to the php program installation directory:
[root@linux php-7.3.10] # cp php.ini-development / usr/local/php-fpm/etc/php.ini
Copy the startup script to the / etc/init.d/ directory:
[root@linux php-7.3.10] # cp sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm
Go to the / etc directory under the php installation directory to rename the configuration file:
[root@linux php-7.3.10] # cd / usr/local/php-fpm/etc/ [root@linux etc] # cp php-fpm.conf.default php-fpm.conf [root@linux etc] # cd php-fpm.d/ [root@linux php-fpm.d] # cp www.conf.default www.conf
Add a php startup script to the system service:
[root@linux php-fpm.d] # chkconfig-- add php-fpm [root@linux php-fpm.d] # chkconfig php-fpm on [root@linux php-fpm.d] # chmod 755 / etc/init.d/php-fpm
To create a php user:
[root@linux php-fpm.d] # useradd php-fpm
Start php:
[root@linux php-fpm.d] # service php-fpm start
Compile and install php error resolution:
Error 1:checking for gcc... No
Solution: yum-y install gcc
Error 2:error: libxml2 not found
Solution: yum install-y libxml2-devel
Error 3:error: Cannot find OpenSSL's
Solution: yum install-y openssl-devel
Error 4:error: cURL version 7.15.5 or later is required
Solution: yum install-y libcurl-devel
Error 5:configure: error: jpeglib.h not found
Solution: yum install-y libjpeg-turbo-devel
Error 6:configure: error: png.h not found
Solution: yum install-y libpng-devel
Error 7:configure: error: freetype-config not found
Solution: yum install-y freetype-devel
Error 8:configure: error: wrong mysql library version or lib not found
This error indicates that the currently installed version of MySQL/MariaDB is too high. Download a lower version of the MySQL package and change the path where the compilation parameter contains MySQL/MariaDB to the lower version MySQL program directory. There is no need to install the lower version of MySQL.
Resolve:
1. Download the MySQL5.6 binary package:
[root@linux ~] # cd / usr/local/src/ [root@linux src] # wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz
two。 Decompress:
[root@linux src] # tar-zxvf mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz
3. Move to the / usr/local/ directory and rename it to mysql5.6:
[root@linux src] # mv mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz / usr/local/mysql5.6
4. Change the compilation parameters-- with-mysql,--with-mysqli,--with-pdo-mysql to the path to the MySQL5.6 directory:
/ configure-- prefix=/usr/local/php-fpm-- with-config-file-path=/usr/local/php-fpm/etc-- enable-fpm-- with-fpm-user=php-fpm-- with-fpm-group=php-fpm-- with-mysql=/usr/local/mysql5.6-- with-mysqli=/usr/local/mysql5.6/bin/mysql_config-- with-pdo-mysql=/usr/local/mysql5.6-- with-mysql-sock=/tmp/mysql.sock-- with- Libxml-dir-with-gd-with-jpeg-dir-with-png-dir-with-freetype-dir-with-iconv-dir-with-zlib-dir-with-mcrypt-enable-soap-enable-gd-native-ttf-enable-ftp-enable-mbstring-enable-exif with-pear with-curl with-openssl
Error 9:ERROR: [pool www] cannot get uid for user 'php-fpm'
Just create the php user specified in the compilation parameters
Solution: useradd php-fpm
Nginx official website: http://nginx.org/
Compile and install nginx:
Installation package storage path / usr/local/src
Download:
[root@linux src] # wget http://nginx.org/download/nginx-1.16.1.tar.gz
Decompress:
[root@linux src] # tar-zxvf nginx-1.16.1.tar.gz
Enter the nginx source package directory:
[root@linux src] # cd nginx-1.16.1/
Configure compilation parameters:
[root@linux nginx-1.16.1] # / configure-- prefix=/usr/local/nginx-- with-http_ssl_module
Compile and install:
[root@linux nginx-1.16.1] # make & & make install
Start nginx:
[root@linux ~] # / usr/local/nginx/sbin/nginx [root@linux ~] # netstat-lntp | grep nginxtcp 0 0 0.0 0. 0 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. Lntp * LISTEN 11494/nginx: master
Add:
If you do not want to start nginx with an absolute path, you can softly connect the nginx startup script to the environment variables directory:
[root@linux] # ln-s / usr/local/nginx/sbin/nginx / usr/bin/nginx
Start nginx:
[root@linux ~] # nginx [root@linux ~] # ps-ef | grep nginxroot 11580 1 0 21:58? 00:00:00 nginx: master process nginxnobody 11581 11580 0 21:58? 00:00:00 nginx: worker processroot 11584 7705 0 21:59 pts/0 00:00:00 grep-- color=auto nginx
Turn off nginx:
[root@linux] # nginx-s stop
Yum installation nginx:
Official statement: http://nginx.org/en/linux_packages.html
Configure the nginx repository:
[root@linux ~] # vi / etc/yum.repos.d/nginx.repo
Add the following:
[nginx-stable] name=nginx stable repobaseurl= http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=1enabled=1gpgkey=https://nginx.org/keys/nginx_signing.keymodule_hotfixes=true
Yum installation nginx:
[root@linux ~] # yum-y install nginx
Configuration file path:
[root@linux ~] # ls / etc/nginx/conf.d koi-utf mime.types nginx.conf uwsgi_paramsfastcgi_params koi-win modules scgi_params win-utf
Startup script path:
[root@linux ~] # which nginx/usr/sbin/nginx
Start nginx:
[root@linux ~] # systemctl start nginx [root@linux ~] # ps-ef | grep nginxroot 12410 10 22:42? 00:00:00 nginx: master process / usr/sbin/nginx-c / etc/ngin/nginx.confnginx 12411 12410 0 22:42? 00:00:00 nginx: worker processroot 12413 7705 0 22:42 pts/0 00:00:00 grep-- color=auto nginx
Turn off nginx:
[root@linux ~] # systemctl stop nginx
By modifying the nginx configuration file to configure the nginx virtual host, a nginx server (web server) can configure multiple sites through the virtual host
Configure a single virtual host:
Edit the nginx virtual host configuration file. Since the previous article used nginx installed by yum, the path to the nginx virtual host configuration file is: / etc/nginx/conf.d/default.conf
Edit the configuration file:
[root@linux ~] # vi / etc/nginx/conf.d/default.conf
Define the site domain name corresponding to the server_name entry:
Verify the profile:
[root@linux ~] # nginx-tnginx: the configuration file / etc/nginx/nginx.conf syntax is oknginx: configuration file / etc/nginx/nginx.conf test is successful
Reload nginx to take effect:
[root@linux] # nginx-s reload
Since the custom domain name used by www.test.com for the test cannot be resolved to the tested nginx server, you need to modify the Windows configuration file hosts:
Open the configuration file: C:\ Windows\ System32\ drivers\ etc\ hosts
Add the web server address and the corresponding domain name:
You can access www.test.com in your browser:
Configure multiple virtual hosts:
Copy the virtual host configuration file:
[root@linux ~] # cd / etc/nginx/conf.d/ [root@linux conf.d] # lsdefault.conf [root@linux conf.d] # cp default.conf testbaidu.conf
# the virtual host file is named as the domain name to be configured for easy maintenance
Edit the file:
[root@linux conf.d] # vi testbaidu.conf
Define the site domain name for the server_name entry and the site directory for the root entry:
Verify and reload nginx:
[root@linux ~] # nginx-tnginx: the configuration file / etc/nginx/nginx.conf syntax is oknginx: configuration file / etc/nginx/nginx.conf test is successful [root@linux ~] # nginx-s reload
Create the site corresponding directory and index.html file:
[root@linux conf.d] # mkdir-p / tmp/testbaidu [root@linux conf.d] # touch / tmp/testbaidu/index.html [root@linux conf.d] # echo "nginx_test" > $?
Modify the Windows system host file:
Simply visit www.testbaidu.com:
Default virtual host:
The role of the default virtual host is: if multiple accessed domain names point to this web server, but a domain name is not added to the nginx virtual host, the default virtual host will be accessed (universal resolution)
View the virtual host configuration file directory: / etc/nginx/conf.d/
[root@linux conf.d] # lsdefault.conf testbaidu.conf
# when multiple virtual host profiles exist in this directory, the default virtual host is at the top of the list
When modifying the hosts file of the Windows system above, an additional domain name, www.abc.com, is added. If the domain name is not configured with a virtual host, the default virtual host will be accessed when accessed.
Test:
# the result of loading is the page pointed to by the default virtual host default.conf
Set testbaidu.conf as the default virtual host, and edit testbaidu.conf:
[root@linux conf.d] # vi testbaidu.conf
Just add default after the port number:
Verify and restart nginx:
[root@linux conf.d] # nginx-tnginx: the configuration file / etc/nginx/nginx.conf syntax is oknginx: configuration file / etc/nginx/nginx.conf test is successful [root@linux conf.d] # nginx-s reload
Visit www.abc.com again:
# display the virtual host page with the result of testbaidu.conf
Disable the nginx default virtual host:
# add a line to the default virtual host configuration file: deny all;
When the nginx default virtual host is disabled, the accessed domain name will be prompted with a 403 error if it is not defined in the nginx virtual host profile server_name entry:
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.