nginx的安装使用

  nginx

官网:http://nginx.org/
虚拟主机的php-fpm配置实例:

server
{
    listen 80;
    #listen [::]:80;
    server_name useosc.com www.useosc.com;
    index index.php index.html index.htm default.html default.htm default.php;
    root  /var/www/html/;

    #error_page   404   /404.html;

    location ~ [^/]\.php(/|$)
    {
        try_files $uri =404;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        #fastcgi_pass  unix:/tmp/php-cgi.sock;
        #fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        #fastcgi_param PHP_RUNTIME_ENVIROMENT "PROD";
        #fastcgi_param PHP_DATABASE_PASSWORD  "";
        include fastcgi.conf;
    }

    location / {
            if (!-e $request_filename) {
                    rewrite  ^(.*)$  /index.php?s=/$1  last;
            }
    }

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

    location ~ .*\.(js|css)?$
    {
        expires      12h;
    }

    location ~ /.well-known {
        allow all;
    }

    location ~ /\.
    {
        deny all;
    }

    access_log  /var/wwwlogs/useosc.com.log;
}