In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how centos8 customizes the directory to install nginx. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. Install tools and libraries
# PCRE is a Perl library, including a perl-compatible library of regular expressions. Nginx's http module uses pcre to parse regular expressions
# the zlib library provides many ways to compress and decompress. Nginx uses zlib to gzip the contents of http packages
Yum-y install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
two。 Directory structure
Source directory: / home/werben/pkgsrc/nginx
Installation directory: / home/werben/application/nginx
3. Download the decompression source code
# official website address: https://nginx.org/en/download.html
Wget-c https://nginx.org/download/nginx-1.17.5.tar.gz
4. Create user groups and users
Groupadd wwwuseradd-g www www
5. Compile source code
. / configure-- user=www-- group=www-- prefix=/home/werben/application/nginx-- with-http_v2_module-- with-http_ssl_module-- with-http_sub_module-- with-http_stub_status_module-- with-http_gzip_static_module-- with-http_flv_module-- with-http_mp4_module-- with-pcremake & & make install
6. Map global command
Ln-s / home/werben/application/nginx/sbin/nginx / usr/local/bin/nginx
7. Start, stop, restart
Nginx-s stopnginx-s quitngins-s reload
8. Check the correctness of the profile nginx.conf
Nginx-t
9. Boot self-start
Vim / lib/systemd/system/ nginx.service[ Unit] Description=nginxAfter= network.target [Service] Type=forkingExecStart=nginxExecReload=nginx reloadExecStop=nginx quitPrivateTmp= truth [install] WantedBy=multi-user.target# reload daemon process systemctl daemon-reload# start nginx service systemctl start nginx.service# stop nginx service systemctl stop nginx.service# setting boot systemctl enable nginx.service# stop boot systemctl disable nginx.service# view service current status systemctl status nginx.service# restart service systemctl restart nginx.service# check Look at all the started service systemctl list-units-- type=service
10. Problems and solutions
# if `systemctl start nginx.service` prompts Job for nginx.service failed because the control process exited with error code.See "systemctl status nginx.service" and "journalctl-xe" for details.# to execute systemctl status nginx.service# if the following error occurs Process: 35783 ExecStart=...nginx/sbin/nginx (code=exitedstatus=203/EXEC) nginx.service: Control process exited, code=exitedstatus=203 systemd [1]: nginx.service: Failed with result 'exit-code'. Localhost.localdomain systemd [1]: Failed to start nginx.journalctl-xe# if you see the following information If you believe that systemd should be allowed execute access on the > Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # ausearch-c'(nginx)'--raw | audit2allow-M my-nginx # semodule-X 300-I my-nginx.pp# solution setenforce 0vim / etc/selinux/configSELINUX=disabled
Structural description of the ps:Nginx configuration file
All Nginx configuration files are located in the / etc/nginx/ directory.
The main configuration file for Nginx is / etc/nginx/nginx.conf.
Create a separate profile for each domain to make the server easy to maintain.
The Nginx server block file must end with .conf and be stored in the / etc/nginx/conf.d directory. You can have as many server blocks as you need.
It is a good habit to follow standard naming conventions. For example, if the domain name is mydomain.com, the configuration file should be named mydomain.com.conf
If repeatable configuration segments are used in a domain server block, it is best to ReFactor those segments into fragments.
The Nginx log files (access.log and error.log) are located in the / var/log/nginx/ directory. It is recommended that there are different access and error log files for each server module.
You can set the root directory of the domain document to any location you want. The most common locations for webroot include:
/ home///var/www//var/www/html//opt//usr/share/nginx/html Thank you for your reading! On "centos8 how to customize the directory installation nginx" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!
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.