项目情况:
nginx说明:
利用404,405的处理方法.
复制代码代码如下:
upstream music_ser{
server 172.16.100.10:80 weight=1; server 172.16.100.11:80 weight=1; }
定义一个Server:
复制代码代码如下:
server {
listen 80; server_name music.wubx.com; access_log /data/logs/music_access.log proxy_temp_path /data/Cache/temp; root /data/Cache/$host; location / { index index.php; error_page 404 = /fetch$uri; } location /fetch { internal; proxy_pass http://music_ser; proxy_store on; proxy_store_access user:rw group:rw all:rw; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Via "nginx"; alias /data/Cache/$host; } }
完成配置nginx.conf
复制代码代码如下:
user nobody;
events {
http {
用一个脚本去除理常放置时间长的文件:
复制代码代码如下:
#!/bin/bash
mkdir /data/Cache mkdir /data/Cache/temp chown -R nobody:nobody /data/Cache fine /data/Cache/$host -type -atime 30 |xargs rm -rf {}\
$host换成你域名 |