nginx配置文件模板

1.nginx.conf

worker_processes  1;
user nginx nginx;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    include extra/*.conf;
}

2.extra/xxx.conf

server {
        listen       80;
        server_name  blog.etiantian.org;
        location / {
            root   html/blog;
            index  index.html index.htm index.php;
        }
        location ~ .*\.(php|php5)?$ {
            root html/blog;
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi.conf;
        }
}

3.负载均衡配置

upstream backend {
        server 10.0.0.8:80 weight=1;
        server 10.0.0.7:80 weight=1;
    }
    upstream static_backend {
        server 10.0.0.9:80 weight=1;
        server 10.0.0.10:80 weight=1;
    }

    server {
        listen       80;
        server_name  blog.etiantian.org;
        location / {
            proxy_pass http://backend;
            proxy_set_header Host  $host;
            proxy_set_header X-Forwarded-For $remote_addr;
        }
        location /wp-content/ {
            proxy_pass http://static_backend;
            proxy_set_header Host  $host;
            proxy_set_header X-Forwarded-For $remote_addr;
        }
}

4.静态web配置

server {
        listen       80;
        server_name  blog.etiantian.org;
        location / {
            root   html/blog;
            index  index.html index.htm index.php;
        }
}

5.全网备份模板(backup)

cat >/server/scripts/del.sh</backup/\${time}.log  &&\
find /backup/ -type f -name "*{\$time}.tar.gz" -mtime +180 |xargs rm -f &&\
find /backup/ -type f ! -name "*week*" -mtime +7 |xargs rm -f
#mail
mail -s "\${time}.rsync.log" [email protected] < /backu/\${time}.log
EOF
cat >/server/scripts/dabao</backup/\$IP/\$(date +%F -d -1day).md5 &&\
#推送
rsync -avz /backup/\$IP/*\${time}* [email protected]::backup/\$IP &&\
#删除
find /backup/\$IP/ -type f -mtime +7|xargs rm -f
EOF

6.nfs共享服务(nfs)

cat >/server/scripts/dabao.sh</backup/\$IP/\$(date +%F -d -1day).md5 &&\
#推送
rsync -avz /backup/\$IP/*\${time}* [email protected]::backup/\$IP &&\
#删除
find /backup/\$IP/ -type f -mtime +7|xargs rm -f
EOF

你可能感兴趣的:(nginx配置文件模板)