In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. download
Download address on the official website
two。 Deployment
2.1 installation prerequisite
To install under linux, you need to install the components
1. Gcc & g++yum install gcc-c++2. Pcreyum install-y pcre pcre-devel3. Zlibyum install-y zlib zlib-devel4. Opensslyum install-y openssl openssl-devel
2.2 installation
1. Extract the nginx file tar-zxvf nginx-1.17.5.tar.gz2. Install # # create a nginx installation directory mkdir nginxcd nginx-1.12.2## specify the file installation path. / configure-- after the prefix=/home/lege/nginxmakemake install# installation is completed, the content will be installed to the specified path / home/lege/nginx, otherwise it will be in the default directory / usr/local/nginx
2.3 start nginx
# # modify the configuration file cd / home/lege/nginx/confvim nginx.conf## to set the port to 8080 or other listen 8080 # # enter the startup directory cd / home/lege/nginx/sbin## to check whether there is a problem with the configuration file. / nginx-tasking # the result of no problem is as follows: [soa@testsoa04 sbin] $. / nginx-tnginx: the configuration file / home/lege/nginx/conf/nginx.conf syntax is oknginx: configuration file / home/lege/nginx/conf/nginx.conf test is successful [soa@testsoa04 sbin] $# # query configuration parameters. / Nginx-prefix=/home/lege/nginx # needs to modify the configuration parameters for the installed nginx. / configure-- prefix=/home/lege/nginx. Configuration parameter makemake install and then restart nginx can # # start. / nginx## stop. / nginx-s stop## restart. / nginx-s reload## enter the URL to verify whether the http://ip:port/3. nginx log has been started successfully the format defined by the configuration log: syntax format: access_log path [format [buffer=size] [gzip [= level]] [flush=time] [if=condition]; access_log off Default value: access_log logs/access.log combined; scope: http, server, location, if in location, limit_except 1. Define log format syntax format: log_format name [escape=default | json] string...; default value: log_format combined "..." Scope: http common log variables $remote_addr, $http_x_forwarded_for record client IP address $remote_user record client user name $request record request URL and HTTP protocols (GET,POST,DEL, etc.) $status record request status $number of bytes sent to the client by body_bytes_sent, excluding the size of the response header This variable is compatible with the "% B" parameter in the Apache module mod_log_config. The total number of bytes sent by $bytes_sent to the client. Serial number of the $connection connection. The number of requests currently obtained by $connection_requests through a connection. $msec log write time. The unit is seconds and the precision is milliseconds. Pipe if the request is sent through the HTTP pipeline (pipelined), the PIP value is "p", otherwise it is ".". $http_referer records the page link from which the $http_user_agent records the client browser related information $request_length request length (including the request line, request header, and request body). Request_time request processing time, in seconds, precision milliseconds, starting from reading the first byte of the client until the last character is sent to the client for log writing. Local time in the time_iso8601 ISO8601 standard format. Local time under the $time_local universal log format. Example: log_format main'$remote_addr-$remote_user [$time_local] "$request"'$status $body_bytes_sent "$http_referer" $request_time "'" $http_user_agent "" $http_x_forwarded_for "
Log-related cleanup can be handled using linux's scheduled tasks. Examples are as follows:
The clear.sh script is as follows:
#! / bin/bash#LOGS_PATH is the log storage path LOGS_PATH=/home/lege/data/nginx/logsYESTERDAY=$ (date-d "yesterday" +% Y-%m-%d) KEEPTIME=$ (date-d "- 3 days" +% Y-%m-%d) # split the log file mv ${LOGS_PATH} / access.log ${LOGS_PATH} / access_$ {YESTERDAY} .logmv ${LOGS_PATH} / error.log ${LOGS_PATH} / error_$ {YESTERDAY} .log # controls rereading logs through Nginx semaphores / web/nginx/ for the nginx installation directory kill-USR1 $(cat / home/lege/data/nginx/logs/nginx.pid) # delete the log file rm-f ${LOGS_PATH} / access_ {KEEPTIME} .logrm-f ${LOGS_PATH} / error_ {KEEPTIME} .logecho 0 crontab-e as follows: 0 * / bin/sh / logecho-l to see if it is added Success 4. Nginx uses it as a file downloader http {server_tokens off Client_header_buffer_size 8k; client_max_body_size 130m; proxy_buffer_size 64k; proxy_buffers 8 64k; log_format access'$remote_addr $host $remote_user [$time_local] $status $request_length $body_bytes_sent $request_time 2000-"-" $request "$http_referer" $http_user_agent "$http_cookie $bytes_sent'; access_log logs/access.log access; keepalive_requests 16; keepalive_timeout 5; server {listen 8080 Server_name localhost; charset utf-8; location / {default_type 'application/octet-stream'; add_header Content-disposition "attachment"; # # configure the file path that can be downloaded. The following is the path used for testing under windows, and the linux can also be replaced with the corresponding path, root DVR.
Restart nginx after the configuration is completed, and then enter the file name under http://ip:8080/conf in the browser to download the corresponding file. Ps: you can't download directories but only files.
Summary
The above is the process of installation, deployment and use of nginx on linux introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to the website!
If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!
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.