s
问题1:locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
解决1:https://www.cnblogs.com/Richard-xie/p/4707484.html
[root@d916e56d345b nginx-1.19.2]# locate nginx.conf
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
[root@d916e56d345b nginx-1.19.2]# updatedb
[root@d916e56d345b nginx-1.19.2]# locate nginx.conf
/etc/nginx/nginx.conf
/opt/nginx-1.19.2/conf/nginx.conf
/opt/nginx-1.19.2/conf/nginx.conf.bak
Centos 7 安装nginx软件
http://nginx.org/en/linux_packages.html#RHEL-CentOS
[root@d916e56d345b nginx-1.19.2]# vim /etc/yum.repos.d/nginx.repo
[nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true [nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true
[root@d916e56d345b nginx-1.19.2]# yum install -y nginx.x86_64
/usr/local/nginx/conf/nginx.conf
user nobody; worker_processes auto; worker_cpu_affinity auto; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { use epoll; accept_mutex off; multi_accept on; worker_connections 10240; } http { resolver 10.19.251.34 valid=30s; resolver_timeout 5s; include mime.types; default_type application/octet-stream; # log_format main '$remote_addr ,- , $remote_user [$time_local] ,"$request" ,' # '$status $body_bytes_sent ,"$http_referer" ,' # '"$http_user_agent" ,"$http_x_forwarded_for"'; # log_format main '$remote_addr $http_x_forwarded_for $remote_user $time_iso8601 $request_method "$document_uri" "$query_string" $server_protocol $status $body_bytes_sent $request_time "$http_referer" "$http_user_agent" $http_Cdn-Src-Ip $host $hostname $server_addr + V4'; # log_format main '$remote_addr $http_x_forwarded_for - $remote_user $time_iso8601 $request_method "$document_uri" "$query_string" $server_protocol $status $body_bytes_sent $request_time "$http_referer" "$http_user_agent" $http_Cdn-Src-Ip $host $hostname $server_addr - - - - - V5'; log_format main '$remote_addr $http_x_forwarded_for - $remote_user ' '$time_iso8601 $request_method "$document_uri" ' '"$query_string" $server_protocol $status $body_bytes_sent ' '$request_time "$http_referer" "$http_user_agent" ' '$http_Cdn-Src-Ip $host $hostname $server_addr ' '$remote_port $server_port ' '"$upstream_addr" "$upstream_status" "$upstream_response_time" V5'; access_log logs/access.log main; server_tokens off; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 15; concat on; #gzip on; gzip on; gzip_vary on; gzip_min_length 1k; gzip_buffers 4 8k; gzip_comp_level 1; gzip_types text/plain application/x-javascript text/css text/htm application/xml application/javascript text/javascript; gzip_http_version 1.1; proxy_buffering off; # 代理http://testdev4.cns*****.com/manual upstream manual { server 10.243.53.49:8080 max_fails=2 fail_timeout=10s; } # 代理http://testdev4.cns*****.com/mobile upstream mobile { server 10.243.53.140:8080 max_fails=2 fail_timeout=10s; } # 代理http://testdev4.cns*****.com/automation upstream automation { server 10.243.53.99:8080 max_fails=2 fail_timeout=10s; } server { listen 80; server_name testdev4.cns*****.com; #charset koi8-r; access_log /opt/rsync_log/access_http.log main; # 默认跳转到manual环境 location / { proxy_pass http://manual; } location /manual{ proxy_pass http://manual; } location /mobile{ proxy_pass http://mobile; } location /automation{ proxy_pass http://automation; } location /NginxStatus { stub_status on; allow 127.0.0.1; allow 192.168.138.0/24; allow 192.168.241.0/24; allow 192.168.242.0/24; allow 192.168.119.0/24; allow 192.168.207.0/24; allow 192.168.90.0/24; allow 192.168.224.34; deny all; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ .php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # # server { # listen 443; # server_name localhost; # access_log /opt/rsync_log/access_https.log main; # server_tokens off; # ssl on; # ssl_certificate cns*****.pem; # ssl_certificate_key cns*****.key; # ssl_session_timeout 5m; # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } # } } #TCP/UDP proxy # #stream { # log_format proxy '$remote_addr $remote_port $realip_remote_addr $realip_remote_port ' # '"$proxy_protocol_addr" "$proxy_protocol_port" $time_iso8601 ' # '$server_addr $server_port $protocol $status $bytes_sent $bytes_received ' # '$session_time $hostname $pid ' # '"$upstream_addr" "$upstream_bytes_sent" "$upstream_bytes_received" ' # '"$upstream_connect_time" "$upstream_first_byte_time" "$upstream_session_time"'; # # proxy_next_upstream on; # proxy_next_upstream_tries 4; # # upstream list1 { # server 192.168.0.1:12345; # server 192.168.0.2:12345; # server 192.168.0.3:12345; # server 192.168.0.4:12345; # server 192.168.0.5:12345; # } # # server { # access_log logs/access_stream.log proxy buffer=1k flush=1s; # # listen 12345; # proxy_pass list1; # } #}
end