nginx server configuration file linux

First, install nginx server  click on the link to open

Second, the configuration server nginx

 

  1.  
    ## test profiles
  2.  
    sudo /usr/sbin/nginx -t
  3.  
     
  4.  
    ## to modify the configuration file
  5.  
    ## 1 in the file server nginx node has: * .conf files in the file include /etc/nginx/conf.d/*.conf nginx conf.d will all automatically incorporated into the profile,
  6.  
    sudo vim /etc/nginx/nginx.conf
  7.  
     
  8.  
    ## 2. Under conf.d directory
  9.  
     
  10.  
    cd /etc/nginx/conf.d
  11.  
    sudo vim fileServer.conf
  12.  
    ---------------------------------
  13.  
    ## file configuration as follows
  14.  
    server {
  15.  
    client_max_body_size 4G;
  16.  
    ## Note 80 ports occupy problem
  17.  
    listen 80; ## listen for ipv4; this line is default and implied
  18.  
    xxx.xxx.xxx server_name; ## your hostname or domain name
  19.  
    root /ysdata/upgrade_file/http;
  20.  
    location / {
  21.  
    autoindex ON; ## displays the index
  22.  
    autoindex_exact_size ON; ## display size
  23.  
    autoindex_localtime ON; ## display time
  24.  
    }
  25.  
    }
  26.  
    ## Save Configuration

Third, nginx reload configuration file

 

  1.  
    // test configuration file
  2.  
    sudo /usr/sbin/nginx -t
  3.  
     
  4.  
    // reload the configuration file
  5.  
    sudo /etc/ init.d/nginx reload
  6.  

Guess you like

Origin www.cnblogs.com/yueminghai/p/11320443.html