Nginx 其他命令
以下包含了 Nginx 常用的几个命令:
/usr/local/webserver/nginx/sbin/nginx -s reload # 重新载入配置文件/usr/local/webserver/nginx/sbin/nginx -s reopen # 重启 Nginx/usr/local/webserver/nginx/sbin/nginx -s stop # 停止 Nginx

发表日期: 2022-09-09 14:01:47 浏览次数:247
上往建站专注于企业网站建设服务,提供网站开发,网站定制,建网站,网站搭建,网站设计,响应式网站制作,网络营销,网站建设,移动端建设,响应式网站,手机网站建设,小程序开发,微信网站制作,网站改版,SEO网站优化,在建设网站时就考虑整站优化,使网站排名靠前,提升网站价值。
比H5更稳定,比APP更方便
一体化营销
石嘴山网站优化

以下包含了 Nginx 常用的几个命令:
/usr/local/webserver/nginx/sbin/nginx -s reload # 重新载入配置文件/usr/local/webserver/nginx/sbin/nginx -s reopen # 重启 Nginx/usr/local/webserver/nginx/sbin/nginx -s stop # 停止 Nginx
网站优化,按词、按效果收费,快速提升关键词排名
手机/微信网站开发
一个后台管理多个终端,利于优化推广实现在手机等移动端小屏幕多屏幕上的“跨屏整合”
服务热线:400-111-6878 手机微信同号:18118153152(各城市商务人员可上门服务)
备案号: 苏ICP备20012587号-8
CopyRight © 2021 常州通陆信息科技有限公司 All Right Reserved 未经许可不得复制转载
24小时服务热线:400-111-6878 E-MAIL:1120768800@qq.com QQ:1120768800
网址:http://www.768800.store/ 网站建设:上往建站
关键词: 昆山网站建设| 昆山域名邮箱| 昆山服务器空间| 昆山网站推广| 昆山书生商友| 昆山网站制作| 昆山网站设计| 昆山域名注册| 昆山网络营销| 昆山网站维护|
昆山企业邮箱| 昆山虚拟主机| 昆山网络建站| 昆山网站服务| 昆山网页设计| 昆山网店美工设计| 昆山网站定制| 昆山企业建站| 昆山网站设计制作| 昆山网页制作公司
欢迎您免费咨询,请填写以下信息,我们收到后会尽快与您联系
全国服务热线:400-111-6878
三好小青年
450***506@qq.com
worker_processes 这个参数最好是设置成 auto 自动匹配进程数。
语法:
auto 在 nginx 1.3.8 和 1.2.5 之后的版本开始支持。
默认:
proxy_next_upstream 这个参数默认的是超时跟错误都会重发,对于一些请求时间过长的连接,最好只设置成错误重发,不然的话会造成二重数据。
三好小青年
450***506@qq.com
alexanderonepills
840***717@qq.com
参考地址
nginx 启动时提示错误:
解决方法:
64 位系统:
32 位系统:
/usr/local/lib/libpcre.so.1 为 prce 安装后的文件地址。
低版本 prce 对应的 libpcre.so.1 为 libpcre.so.0。
alexanderonepills
840***717@qq.com
参考地址
匿名者
gra***ang@fibocom.com
关于 uri 的截取
location 中的 root 和 alias
示例 1:root
#------------目录结构----------/www/x1/index.html/www/x2/index.html#--------配置-----------------------index index.html index.php;location /x/ { root "/www/";}#-------访问--------------curl http://localhost/x1/index.htmlcurl http://localhost/x2/index.html示例 2:alias
#----------配置-----------------location /y/z/ { alias /www/x1/;}#---------访问--------------curl http://localhost/y/z/index.htmllocation 中的 proxy_pass 的 uri
如果 proxy_pass 的 url 不带 uri
如果尾部是"/",则会截断匹配的uri
如果尾部不是"/",则不会截断匹配的uri
如果proxy_pass的url带uri,则会截断匹配的uri
示例:
#-------servers配置--------------------location / { echo $uri #回显请求的uri}#--------proxy_pass配置---------------------location /t1/ { proxy_pass http://servers; } #正常,不截断location /t2/ { proxy_pass http://servers/; } #正常,截断location /t3 { proxy_pass http://servers; } #正常,不截断location /t4 { proxy_pass http://servers/; } #正常,截断location /t5/ { proxy_pass http://servers/test/; } #正常,截断location /t6/ { proxy_pass http://servers/test; } #缺"/",截断location /t7 { proxy_pass http://servers/test/; } #含"//",截断location /t8 { proxy_pass http://servers/test; } #正常,截断#---------访问----------------------for i in $(seq 6)do url=http://localhost/t$i/doc/index.html echo "-----------$url-----------" curl urldone#--------结果-------------------------------------http://localhost:8080/t1/doc/index.html------------/t1/doc/index.html----------http://localhost:8080/t2/doc/index.html------------/doc/index.html----------http://localhost:8080/t3/doc/index.html------------/t3/doc/index.html----------http://localhost:8080/t4/doc/index.html------------/doc/index.html----------http://localhost:8080/t5/doc/index.html------------/test/doc/index.html----------http://localhost:8080/t6/doc/index.html------------/testdoc/index.html----------http://localhost:8080/t7/doc/index.html------------/test//doc/index.html----------http://localhost:8080/t8/doc/index.html------------/test/doc/index.html匿名者
gra***ang@fibocom.com
root 指令只是将搜索的根设置为 root 设定的目录,即不会截断 uri,而是使用原始 uri 跳转该目录下查找文件
aias 指令则会截断匹配的 uri,然后使用 alias 设定的路径加上剩余的 uri 作为子路径进行查找
Rls
892***40967@qq.com
参考地址
Nginx 配置文件结构
默认的 nginx 配置文件 nginx.conf 内容如下:
#user nobody;worker_processes 1;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events { worker_connections 1024;}http { 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"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } #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; }