freebsd+nginx+php 配置文件

@fright  November 2, 2017

默认nginx.conf 配置

#user  nobody;
worker_processes  1;
#error_log  /var/log/nginx/error.log;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    server_names_hash_bucket_size   128;
    client_header_buffer_size       32k;
    large_client_header_buffers     4 32k;
    client_max_body_size            50m;

    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;
    server_tokens   off;
    keepalive_timeout  60;

    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 256k;

    gzip                on;
    gzip_min_length     1k;
    gzip_buffers        4 16k;
    gzip_http_version   1.0;
    gzip_comp_level     2;
    gzip_types          text/plain application/x-javascript text/css application/x
ml;
    gzip_vary on;
    gzip_proxied        expired no-cache no-store private auth;
    gzip_disable        "MSIE [1-6]\.";

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    index index.html index.php;

    include /usr/local/etc/nginx/vhost/*.conf;
}

2、vhost/default.conf

server {
    listen 80 default rcvbuf=64K backlog=128;
    server_name _;

    gzip off;
    gzip_vary off;
    root /data/webroot/default;

    location / {
        index  index.html index.php;
        expires -1;
        add_header Cache-Control no-cache;
        add_header Cache-Control private;
    }

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

    location ~ /\.ht {
        deny  all;
    }
}

3、正常配置文件

server
{
    listen       80;
    server_name api.test.legcc.com;
    index index.html index.htm index.php;
    root  /data/webroot/zd.api/web;
    access_log  /data/logs/nginx/api.access.log  main;

    location /
    {
        if (!-e $request_filename){ rewrite (.*) /index.php last;}
    }

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

    location ~ /\.ht
    {
        deny  all;
    }
}

4、thinkphp配置文件

server
{
    listen       80;
    server_name weibadoc.com;
    index index.html index.htm index.php;
    root  /data/webroot/weibadoc.com;
    access_log  /data/logs/nginx/weibadoc.access.log  main;

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

    location ~ .+\.php($|/) {
        set $script    $uri;
        set $path_info  "/";
        if ($uri ~ "^(.+\.php)(/.+)") {
            set $script     $1;
            set $path_info  $2;
         }

        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index  index.php?IF_REWRITE=1;
        include fastcgi_params;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param SCRIPT_FILENAME  $document_root/$script;
        fastcgi_param SCRIPT_NAME $script;
    }

    location ~ /\.ht
    {
        deny  all;
    }
}

svn shell文件

#!/bin/sh
cd /data/temp/
/usr/local/bin/svn export https://123.56.160.49/svn/wxcslm
rm -rf wxcslm/QzCms/Data/*
rm -rf wxcslm/QzCms/Runtime/*
rm -rf wxcslm/TinkPHP/*
cp -rf /data/temp/wxcslm/* /data/webroot/wxcslm/
rm -rf /data/temp/*

添加新评论