单台机器动静分离

1.配置

[root@web01 /code]# cat /etc/nginx/conf.d/linux.blog.com.conf 
server {
    listen 80;
    server_name linux.blog.com;
    root /code/wordpress;

    location / {
        index index.php;
    }

    location ~* \.(jpg|png)$ {
        root /code/pic;
        root /code/wordpress;
    }

    location ~* \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

 

2.创建目录

[root@web01 /code]# mkdir /code/pic

 

3.做软连接

[root@web01 /code]# ln -s /code/wordpress/wp-content /code/pic

 

posted @ 2020-09-05 09:59  六月OvO  阅读(69)  评论(0编辑  收藏  举报