NGINX config for WebApp



  • Hi all,

    Hello everybody, I have big problems with the configuration of my NGinx server in connection with the WebApp. I use the following configuration in NGinx:

    location /webapp {
        alias /usr/share/kopano-webapp/;
        index index.php;
     
    location ~ /webapp/presence/ {
                rewrite ^/webapp/presence(/.*)$ $1 break;
                proxy_pass http://localhost:1234;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_http_version 1.1;
                }
    
    }
    
    location ~* ^/webapp/(.+\.php)$ {
        alias /usr/share/kopano-webapp/;
    
        # deny access to .htaccess files
        location ~ /\.ht {
                    deny all;
        }
    
    
        fastcgi_param PHP_VALUE "
            register_globals=off
            magic_quotes_gpc=off
            magic_quotes_runtime=off
            post_max_size=31M
            upload_max_filesize=30M
        ";
        fastcgi_param PHP_VALUE "post_max_size=31M
                 upload_max_filesize=30M
                 max_execution_time=3660
        ";
    
        include fastcgi_params;
        fastcgi_index index.php;
        #fastcgi_param HTTPS on;
        fastcgi_param SCRIPT_FILENAME $document_root$1;
        fastcgi_pass php-handler;
        access_log /var/log/nginx/kopano-webapp-access.log;
        error_log /var/log/nginx/kopano-webapp-error.log;
    
        # CSS and Javascript
        location ~* \.(?:css|js)$ {
            expires 1y;
            access_log off;
            add_header Cache-Control "public";
        }
    
        # All (static) resources set to 2 months expiration time.
        location ~* \.(?:jpg|gif|png)$ {
            expires 2M;
            access_log off;
            add_header Cache-Control "public";
        }
    
        # enable gzip compression
        gzip on;
        gzip_min_length  1100;
        gzip_buffers  4 32k;
        gzip_types    text/plain application/x-javascript text/xml text/css application/json;
        gzip_vary on;
        }
    

    When I call the WebApp I get the following error in error.log:

    2019/11/22 20:49:42 [error] 29201#29201: *414 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.120.13, server: server.xxxx.yyyy.de, request: "GET /webapp/ HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "server.xxxx.yyyy.de"
    

    Can anyone help me here?


  • Kopano

    @cblaha

    Does nginx have enough permissions to use the php socket (/run/php/php7.3-fpm.sock)



  • @robing : I will check it. Thanks for your feedback


Log in to reply