2017-02-21 8 views
0

私はTypo3と組み合わせてNginxを使用します。私のTypo3 - インストールには約8つのドメインがあります。すべてが魅力のように機能します。今私は問題がある、私は各ドメインのために働いているAWStatsを使用したいが、私はどのように私はすべてのドメインのアクセスログを分離することができないのか分からない。Nginxは各ドメインのアクセスログを別々にします

user www-data; 
 
worker_processes auto; 
 
pid /run/nginx.pid; 
 

 
events { 
 
\t worker_connections 5000; 
 
\t multi_accept on; 
 
     use epoll; 
 
} 
 

 
http { 
 

 
\t ## 
 
\t # Basic Settings 
 
\t ## 
 

 
\t sendfile on; 
 
\t tcp_nopush on; 
 
\t tcp_nodelay on; 
 
\t keepalive_timeout 65; 
 
\t types_hash_max_size 2048; 
 
\t # server_tokens off; 
 

 
\t # server_names_hash_bucket_size 64; 
 
\t # server_name_in_redirect off; 
 

 
\t include /etc/nginx/mime.types; 
 
\t default_type application/octet-stream; 
 

 
\t ## 
 
\t # SSL Settings 
 
\t ## 
 

 
# \t ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE 
 
# \t ssl_prefer_server_ciphers on; 
 

 
\t ## 
 
\t # Logging Settings 
 
\t ## 
 

 
\t access_log /var/log/nginx/access.log; 
 
\t error_log /var/log/nginx/error.log; 
 

 
\t ## 
 
\t # Gzip Settings 
 
\t ## 
 

 
\t gzip on; 
 
\t gzip_disable "msie6"; 
 

 
\t gzip_vary on; 
 
\t gzip_proxied any; 
 
\t gzip_comp_level 6; 
 
\t gzip_buffers 16 8k; 
 
\t gzip_http_version 1.1; 
 
\t gzip_min_length 256; 
 
     gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; 
 

 
\t ## 
 
\t # Virtual Host Configs 
 
\t ## 
 

 
\t include /etc/nginx/conf.d/*.conf; 
 
\t include /etc/nginx/sites-enabled/*; 
 
}

I nginx.confサイトで入手可能な

server { 
 
    listen  127.0.0.1:80; 
 
    server_name www.domain1.de 
 
         www.domain2.de 
 
         www.domain3.de 
 
    root  "/var/www/oz/htdocs/"; 
 
    disable_symlinks if_not_owner; 
 
    location ~ /\.ht { 
 
     deny all; 
 
    } 
 

 
    location ~ ^/cgi-bin/ { 
 
     deny all; 
 
    } 
 

 

 
    # PHP is enabled 
 
    index index.php index.html index.htm; 
 
    location ~ \.php(/|$) { 
 
     try_files $fastcgi_script_name =404; 
 
     fastcgi_split_path_info ^(.+\.php)(/.*)$; 
 
     include /etc/nginx/fastcgi_params; 
 
     set $path_info $fastcgi_path_info; 
 
     fastcgi_param PATH_INFO $path_info; 
 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
 
     fastcgi_index index.php; 
 
     fastcgi_pass unix:/var/www/oz/conf/sockets/nginx-php-fcgi.sock; 
 
     fastcgi_read_timeout 300; 
 
       fastcgi_buffer_size 128k; 
 
       fastcgi_buffers 256 4k; 
 
       fastcgi_busy_buffers_size 256k; 
 
    } 
 

 
    location =/{ 
 
     error_page 403 /.errorFiles/coming-soon.html; 
 
    } 
 
    location /.errorFiles/ { 
 
     alias /usr/share/liveconfig/html/; 
 
    } 
 

 

 
#### NGINX Typo3 Config - Start ##### 
 

 

 
     location = /favicon.ico { 
 
       log_not_found off; 
 
       access_log off; 
 
     } 
 

 
     location = /robots.txt { 
 
       allow all; 
 
       log_not_found off; 
 
       access_log off; 
 
     } 
 

 
     # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac). 
 
     location ~ /\. { 
 
       deny all; 
 
       access_log off; 
 
       log_not_found off; 
 
     } 
 

 
     client_max_body_size 200M; 
 

 
     location ~ /\.(js|css)$ { 
 
       expires 604800s; 
 
     } 
 

 
     location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { 
 
       expires 365d; 
 
       
 
     } 
 
     if (!-e $request_filename){ 
 
       rewrite ^/(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ /$1.$3 last; 
 
     } 
 

 
     location ~* ^/fileadmin/(.*/)?_recycler_/ { 
 
       deny all; 
 
     } 
 
     location ~* ^/fileadmin/templates/.*(\.txt|\.ts)$ { 
 
       deny all; 
 
     } 
 
     location ~* ^/typo3conf/ext/[^/]+/Resources/Private/ { 
 
       deny all; 
 
     } 
 
     location ~* ^/(typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) { 
 
     } 
 

 
     location/{ 
 
         if ($query_string ~ ".+") { 
 
           return 405; 
 
         } 
 
         if ($http_cookie ~ 'nc_staticfilecache|be_typo_user|fe_typo_user') { 
 
           return 405; 
 
         } # pass POST requests to PHP 
 
         if ($request_method !~ ^(GET|HEAD)$) { 
 
           return 405; 
 
         } 
 
         if ($http_pragma = 'no-cache') { 
 
           return 405; 
 
         } 
 
         if ($http_cache_control = 'no-cache') { 
 
           return 405; 
 
         } 
 
         error_page 405 = @nocache; 
 

 
         try_files /typo3temp/tx_ncstaticfilecache/$host${request_uri}index.html @nocache; 
 
     } 
 

 
     location @nocache { 
 
         try_files $uri $uri/ /index.php$is_args$args; 
 
     } 
 

 
#### NGINX Typo3 Config - End ##### 
 
} 
 

 
server { 
 
    listen  127.0.0.1:80; 
 
    server_name domain1.de; 
 
    rewrite  ^/(.*)$ "http://www.domain1.de/$1" permanent; 
 
} 
 

 
server { 
 
    listen  127.0.0.1:80; 
 
    server_name domain2.de; 
 
    rewrite  ^/(.*)$ "http://www.domain2.de/$1" permanent; 
 
} 
 

 
server { 
 
    listen  127.0.0.1:80; 
 
    server_name domain3.de; 
 
    rewrite  ^/(.*)$ "http://www.domain3.de/$1" permanent; 
 
}

内部

設定ファイル:次のようにあなたは私の設定がactuall動作しているかを確認することができますそれをサーバーブロックの中で分離しようとしました。しかし、私はそれを働かせることはありません。誰でも私を助けることができますか、いくつかのヒントがありますか?

ありがとうございます!

フィリップ

答えて

0

serverは、それ自身のアクセスログの場所を上書きすることができます

server { 
    listen  127.0.0.1:80; 
    server_name domain1.de; 
    access_log /var/log/nginx/domain1-access.log; 
    error_log /var/log/nginx/domain1-error.log; 
    rewrite  ^/(.*)$ "http://www.domain1.de/$1" permanent; 
} 

server { 
    listen  127.0.0.1:80; 
    server_name domain2.de; 
    access_log /var/log/nginx/domain2-access.log; 
    error_log /var/log/nginx/domain2-error.log; 
    rewrite  ^/(.*)$ "http://www.domain2.de/$1" permanent; 
} 

server { 
    listen  127.0.0.1:80; 
    server_name domain3.de; 
    access_log /var/log/nginx/domain3-access.log; 
    error_log /var/log/nginx/domain3-error.log; 
    rewrite  ^/(.*)$ "http://www.domain3.de/$1" permanent; 
} 
関連する問題