In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
Today Xiaobian to share with you CentOS7 install Nginx and configure automatic start instance analysis related knowledge points, detailed content, clear logic, I believe most people still know too much about this knowledge, so share this article for everyone to refer to, I hope you read this article after some harvest, let's learn about it together.
1. Download the installation package from the official website
Select the version suitable for linux, here select the latest version, download it locally and upload it to the server or download it directly with wget command under centos.
Switch to/usr/local directory to download packages
# 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 dependency library. If the dependency library is missing, the installation may fail. For details, 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/usr/local/nginx-1.11.5 (do not unzip the package to/usr/local/nginx, or rename the unzipped directory to nginx, because nginx will be installed to/usr/local/nginx by default), switch to nginx-1.11.5/directory
# cd /usr/local/nginx-1.11.5/
Implementation # ./ configure
# ./ configure
This operation checks the current system environment to ensure that nginx can be successfully installed. After performing this operation, the following prompts may appear:
checking for os
+ linux 3.10.0-123.el7.x86_64 x86_64
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 that above prompt appear, 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, it means that the zlib library is missing
If it doesn't appear./ configure: error prompt, indicating that nginx can be installed in the current environment, execute make and make install to compile nginx
# make# make install
If there is no error, it means that nginx has been successfully installed. The default installation location is/usr/local/nginx. 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, you may have extracted the installation package to the/usr/local/nginx directory, the solution is to rename the directory to something else and then execute make,make install.
3. Configure nginx to boot
Change to/lib/systemd/system/directory and create nginx.service file vim nginx.service
# cd /lib/systemd/system/# vim nginx.service
The document reads 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 enable nginx boot
# systemctl enable nginx.service
systemctl start nginx.service Start nginx
systemctl stop nginx.service Ends nginx
systemctl restart nginx.service Restart nginx
4, verify whether the installation is successful
Enter http://server ip/If you can see the interface of nginx, it means that the installation is successful.
The above is "CentOS7 install Nginx and configure automatic start instance analysis" all the content of this article, thank you for reading! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.
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.