nginx 설정 접근 주소

3674 단어 nginx
[root@localhost ~]# cd /usr/local/nginx/conf/
[root@localhost conf]# ls
fastcgi.conf          fastcgi_params          koi-utf  mime.types          nginx.conf          scgi_params          uwsgi_params          vhosts_conf
fastcgi.conf.default  fastcgi_params.default  koi-win  mime.types.default  nginx.conf.default  scgi_params.default  uwsgi_params.default  win-utf
[root@localhost conf]# cat nginx.conf

user  www www;
worker_processes  4;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

worker_rlimit_nofile 65535;

#pid        logs/nginx.pid;

events {
    use epoll;
    worker_connections  65535;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

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

    #access_log  /var/www/logs/access.log;

    server_names_hash_bucket_size 128;
    client_header_buffer_size 8k;
    large_client_header_buffers 4 64k;
    client_max_body_size 8m;

    sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  60;

  tcp_nodelay on;

open_file_cache max=65535 inactive=20s;
open_file_cache_min_uses 1;
open_file_cache_valid 30s;


 fastcgi_connect_timeout 100000;
 fastcgi_send_timeout 100000;
 fastcgi_read_timeout 100000;
 fastcgi_buffer_size 64k;
 fastcgi_buffers 8 64k;
 fastcgi_busy_buffers_size 64k;
#fastcgi_temp_file_write_size 64k;
#fastcgi_cache_path /usr/local/nginx/fastcgi_cache levels=1:2 keys_zone=API_CACHE:128m inactive=1d max_size=10g;
#fastcgi_cache_key "$request_method://$host$request_uri";
#fastcgi_cache_methods GET HEAD;
#fastcgi_cache API_CACHE;
#fastcgi_cache_valid 200 302 1h;
#fastcgi_cache_valid any 1m;
#fastcgi_cache_min_uses 1;


  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/xml;
  gzip_vary on;

  include vhosts_conf/*.conf;

}
[root@localhost conf]# cd vhosts_conf/
[root@localhost vhosts_conf]# ls
op.conf  shopex.conf  test.conf
[root@localhost vhosts_conf]# vi shopex.conf 
server {
        listen       8080;
        server_name  shopex.stblive.com;

        large_client_header_buffers 4 16k;
        client_max_body_size 300m;
        client_body_buffer_size 128k;
        fastcgi_connect_timeout 100000;
        fastcgi_read_timeout 100000;
        fastcgi_send_timeout 100000;
        fastcgi_buffer_size 64k;
        fastcgi_buffers   4 32k;
        fastcgi_busy_buffers_size 64k;
        fastcgi_temp_file_write_size 64k;

        index index.html index.htm index.php;
        root /www/shopex;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
                rewrite ^/(?!index\.php|assets|demo|bbs)(.*)$ /index.php?kohana_uri=$1 last;
                 if (!-e $request_filename){
                        rewrite ^/(.*)$ /index.php last;
                }
        }

        location ~.*\.(php|php5)?$ {
              # set $nocache yes;
        #       if ( $request_uri ~ "$/weather"){
         #              set $nocache "";
        #        }
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi.conf;
        }


모든 설정 이 완료 되면 다음 nginx 를 다시 시작 합 니 다.
/usr/local/nginx/sbin/nginx -s reload
/usr/nginx/sbin/nginx -s reload

좋은 웹페이지 즐겨찾기