小编Ray*_*Ray的帖子

按位置划分的 NGINX 访问日志

您好,我有两个平台,其中一个作为子目录运行。我希望能够为每个应用程序提供访问和错误日​​志;但是它没有按我的意图工作:(

这是我所拥有的:

server {
    listen 80 default;
    listen [::]:80;

    root /var/www/html/app1;
    index index.php;

    server_name localhost;

    access_log /var/log/nginx/app1.access.log;
    error_log /var/log/nginx/app1.error.log;    

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; allow all; }
    location ~ /\.(?!well-known).* {
            deny all;
            access_log off;
            log_not_found off;
    }
    location ~*  \.(woff|jpg|jpeg|png|gif|ico|css|js)$ {
        access_log off;
        log_not_found off;
        expires 365d;
    }

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


    location /app2 {

        try_files $uri $uri/ /app2/index.php$is_args$args;

        access_log /var/log/nginx/app2.access.log;
        error_log  /var/log/nginx/app2.error.log; …
Run Code Online (Sandbox Code Playgroud)

nginx log-files

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

log-files ×1

nginx ×1