nginx configuration and construction under linux

Step 1: Create a folder in the corresponding directory Example: /home/www/kelikexin
Step 2: Create nginx configuration file ***.conf under /usr/local/nginx/conf/vhost
Step 3: Open and create nginx configuration file copy The following code:

#limit_zone crawler $binary_remote_addr 10m;
#logo log name
log_format *** '$remote_addr - $remote_user [$time_local] "$request" '
                         '$status $body_bytes_sent "$http_referer" '
                         '"$http_user_agent" $http_x_forwarded_for ';
server
{
    #Port number, usually port 80
    listen 80; #Specify the
    URL
    server_name **; #Access

    the entry file
    index index.html index.htm index.php; #Access

    the folder
    root /home/www/file where the file is located folder;
    location / {
        if (!-e $request_filename) {
            rewrite ^/(.*)$ /index.php/$1 last;
    break;
        }
    }

    location ~ .*\.php($|/) {
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_pass  127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME 

/home/www/文件夹/$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires 30d;
    }

    location ~ .*\.(js|css)?$
    {
        expires 1h;
    }
       #logo log
access_log /home/ logs/***.log test.klkx.com;
}

Step 4: Restart nginx
Note: Restart ngnix report (nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
) Wrong
solution : check whether port 80 is occupied
Command: netstat -ntpl
force stop occupancy of port 80 and apply
kill -9 nginx nginx parameter must be process or task ID
to restart nginx.


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326699835&siteId=291194637
Recommended