zoukankan      html  css  js  c++  java
  • Nginx常用命令和配置

    常规配置

    • 利用宝塔面板安装的nginx路径如下:/www/server/nginx

    • 进入配置文件夹中/www/server/nginx/conf

    • 输入vim nginx.conf,打开配置文件,修改,此处引用的是我本机windows系统的文件,请自行修改对应的文件路径

    server {
            listen       80;
            server_name  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location /{
                root   'E:\WorkSpace\Python_worksapce\wyyun';
                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;
            }
        }
    	
    server{
    	listen 90;
    	server_name localhost;
    	# 拥有域名时使用如下格式: 
    	# server_name www.baidu.com;
    	
    	location / {
    		# 文件存储地址
    		root   'E:\WorkSpace\uni-app\Uni-app_Study\next-superhero-dev\unpackage\dist\build\h5';
            index  index.html index.htm;
    		}
    	}
    

    常用命令

    命令 注释
    nginx -c /usr/local/nginx/conf/nginx.conf 启动nginx(windows下start nginx)
    nginx -s quit 停止ngix
    nginx -s reload 重新载入nginx(当配置信息发生修改时)
    nginx -s reopen 打开日志文件
    nginx -v 查看版本
    nginx -t 检查配置是否正确
    nginx -h 查看帮助信息

    当使用其他配置文件时,命令如下所示

    验证配置文件

    /www/server/nginx/sbin/nginx -tc /usr/local/nginx/conf/nginx.conf

    /www/server/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf

    指定配置文件启动

    /www/server/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

    指定配置文件重启

    /www/server/nginx/sbin/nginx -s reload -c /usr/local/nginx/conf/nginx.conf

    以上命令中,第一个路径为你本机安装的nginx的目录,第二个是配置文件的路径,请根据实际情况调节。
    **注:/www/server/nginx/sbin/nginx 目录视自己的安装情况而定。配置文件同样根据自己的命名习惯指定
    **

    参考链接:
    https://blog.csdn.net/binginsist/article/details/58008995
    https://blog.csdn.net/qq_36713022/article/details/104512737

    博观而约取,厚积而薄发
  • 相关阅读:
    Palindrome Linked List 解答
    Word Break II 解答
    Array vs Linked List
    Reverse Linked List II 解答
    Calculate Number Of Islands And Lakes 解答
    Sqrt(x) 解答
    Find Median from Data Stream 解答
    Majority Element II 解答
    Binary Search Tree DFS Template
    188. Best Time to Buy and Sell Stock IV
  • 原文地址:https://www.cnblogs.com/leoych/p/15206820.html
Copyright © 2011-2022 走看看