单台机器动静分离

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

 

上一篇:CentOS 7.8 搭建LNMP(Linux+Nginx+MySQL+PHP)


下一篇:K3S 使用 Docker 作为容器安装运行命令