In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "CentOS7 how to install Nginx and configure automatic startup" related knowledge, editor through the actual case to show you the operation process, the method of operation is simple and fast, practical, I hope that this "CentOS7 how to install Nginx and configure automatic startup" article can help you solve the problem.
1. Download the installation package on the official website
Select the version suitable for linux, select the latest version here, download it locally, upload it to the server or download it directly under the wget command under centos.
Change to the / usr/local directory and download the package
# cd / usr/local# wget http://nginx.org/download/nginx-1.11.5.tar.gz
2. Install nginx
First execute the following command to install the nginx dependent library. If the dependent library is missing, the installation may fail. For more information, please refer to the error message at the end of the article.
# yum install gcc-c++# yum install pcre# yum install pcre-devel# yum install zlib # yum install zlib-devel# yum install openssl# yum install openssl-devel
Extract the installation package
# tar-zxvf nginx-1.11.5.tar.gz
Nginx is unzipped to the / usr/local/nginx-1.11.5 directory (do not extract the package to the / usr/local/nginx directory, or rename the extracted directory to nginx, because nginx will be installed to the / usr/local/nginx directory by default), change to the nginx-1.11.5/ directory
# cd / usr/local/nginx-1.11.5/
Execute #. / configure
#. / configure
This action detects the current system environment to ensure that nginx can be successfully installed, and the following prompts may appear:
Checking for os
+ linux 3.10.0-123.el7.x86_64 x861464
Checking for c compiler... Not found
. / configure: error: c compiler cc is not found
If the above error message appears, execute yum install gcc-c++ to install gcc
. / configure: error: the http rewrite module requires the pcre library.
You can either disable the module by using-without-http_rewrite_module
Option, or install the pcre library into the system, or build the pcre library
Statically from the source with nginx by using-- with-pcre= option.
If the above prompt appears, the pcre library is missing
. / configure: error: the http gzip module requires the zlib library.
You can either disable the module by using-without-http_gzip_module
Option, or install the zlib library into the system, or build the zlib library
Statically from the source with nginx by using-- with-zlib= option.
If the above prompt appears, the zlib library is missing
If the prompt for. / configure: error does not appear, it means that the current environment can install nginx and execute make and make install to compile nginx
# make# make install
If there is no error, nginx has been successfully installed. The default installation location is / usr/local/nginx, and the previous / usr/local/nginx-1.11.5/ can be deleted.
If cp: 'conf/koi-win' and' / usr/local/nginx/conf/koi-win' are the same file appears, you may have unzipped the installation package to the / usr/local/nginx directory. The solution is to rename the directory to another name and then execute make,make install.
3. Configure nginx to boot
Change to the / lib/systemd/system/ directory and create the nginx.service file vim nginx.service
# cd / lib/systemd/system/# vim nginx.service
The contents of the document are as follows:
[unit] description=nginx after=network.target [service] type=forking execstart=/usr/local/nginx/sbin/nginxexecreload=/usr/local/nginx/sbin/nginx reloadexecstop=/usr/local/nginx/sbin/nginx quitprivatetmp=true [install] wantedby=multi-user.target
Exit and save the file, execute systemctl enable nginx.service to boot nginx
# systemctl enable nginx.service
Systemctl start nginx.service starts nginx
Systemctl stop nginx.service ends nginx
Systemctl restart nginx.service restart nginx
4. Verify that the installation is successful
Enter the http:// server ip/. If you can see the interface of nginx, the installation is successful.
This is the end of the introduction to "how CentOS7 installs Nginx and configures automatic startup". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.