Nginx配置记录

  1. 
    # nginx -t 可以检查nginx.conf配置文件语法是否正确,并显示其配置文件的路径
    $ sudo nginx -t
    [sudo] password for adminuser: 
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    

  2. 安装nginx

    
    # debian安装nginx
    $ sudo apt-get install nginx
    
    # 查看系统nginx版本
    $ sudo nginx -v      
    nginx version: nginx/1.10.3
    
  3. 修改Nginx全局配置,打开 /etc/nginx/nginx.conf

    
    $ sudo vim /etc/nginx/nginx.conf
    
  4. nginx的启动、停止和重启

    
    $ sudo /etc/init.d/nginx start
    $ sudo /etc/init.d/nginx stop
    $ sudo /etc/init.d/nginx restart
    

    或者

    
    $ sudo service nginx start
    $ sudo service nginx stop
    $ sudo service nginx restart
    

comments powered by Disqus