partkeepr / PartKeepr

Open Source Inventory Management
http://www.partkeepr.org
GNU General Public License v3.0
1.4k stars 403 forks source link

Nginx Config Install Error Despite Wiki Reference #713

Closed nobicycle closed 4 years ago

nobicycle commented 8 years ago

Hi, Thank you for Partkeepr

I tried the nginx server reference config. https://wiki.partkeepr.org/wiki/KB00005:Web_Server_Configuration

Changing

server_name => server_name partkeepr.localdomain; root => root /srv/http/partkeepr; include fastcgi_params => include /etc/nginx/fastcgi.conf; #I am on Arch linux fastcgi_pass unix://var/run/php/php7.0-fpm.sock; => fastcgi_pass php

php is defined as a socket in at the http section as follows: upstream php { server unix:/run/php-fpm/php-fpm.sock;

These parameter values fastcgi_params and fastcgi_pass work fine in scores of other cases.

Though the error logging is switched off in the reference config, I switch it on and obtained:

016/08/15 23:15:18 [error] 20707#20707: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: partkeepr.localdomain, request: "POST /web/setup.php/setup/webserverTest HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "partkeepr.localdomain", referrer: "http://partkeepr.localdomain/web/setup/index.html"

Note, the socket exists: $ls -l /run/php-fpm/php-fpm.sock srw-rw---- 1 http http 0 Aug 15 23:15 /run/php-fpm/php-fpm.sock

By the way, Is the no-error-logging a Partkeepr requirement or a local requirement of the person supplying the config?

Best wishes

Drachenkaetzchen commented 8 years ago

Unfortunately I don't have much experiences with nginx - as such I can't provide any support for it. A probably good place to ask is the support forums or mailing list of nginx.

The configuration in the wiki was tested using Debian and nginx, maybe that helps a bit.

nobicycle commented 8 years ago

OK. Thanks I'll just post the following as info to others. I just tried this config from: https://github.com/mhubig/docker-partkeepr/blob/master/nginx/default

It ran a bit father as this screen shows: partkeepr

Problem is rewrite. System is:

Linux localhost.localdomain 4.6.2-1-MANJARO #1 SMP PREEMPT Wed Jun 8 11:00:08 UTC 2016 x86_64 GNU/Linux PHP 7.0.8 (cli) (built: Jun 22 2016 16:45:35) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.8, Copyright (c) 1999-2016, by Zend Technologies mysql Ver 15.1 Distrib 10.1.14-MariaDB, for Linux (x86_64) using readline 5.1

watersAbove commented 8 years ago

Hey there. I have a working NGINX configuration that I can share with you. It was more than was mentioned on the wiki in order to get it running. I'll post the config file when I get the chance, and highlight any gotchas. My install is strictly php-7.0.

nobicycle commented 8 years ago

Look forward to seeing it!

watersAbove commented 8 years ago

# Here's my config file the server running partkeepr. Installed on BSD.

Pointers

load_module / usr / local / libexec / nginx / ngx_mail_module.so;
load_module / usr / local / libexec / nginx / ngx_stream_module.so;

user www;
error_log / var / log / nginx / error.log debug;

worker_processes 8;
events {
    worker_connections 1024;
}

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 logs / access.log main;

    sendfile off;
     # tcp_nopush on;

     # keepalive_timeout 0;
    keepalive_timeout 65;

    gzip on;

     # for uploads
    send_timeout 300s;

    server
    {
        listen 443 ssl;
        server_name rareprivateparts.com www.rareprivateparts.com;
        ssl_certificate ssl / rareprivateparts.com.crt;
        ssl_certificate_key ssl / rareprivateparts.com.key;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers HIGH: !aNULL: !MD5;

         # Default index pages
        index app.php index.html;

        charset utf - 8;
         # client_max_body_size 200M;

        access_log / var / log / nginx / rareprivateparts - ssl.access.log;

        root / usr / local / www / nginx;

         # Send file is an optimization,
        but does not work
         # across unix sockets which I use for php fpm so is best
         # used for local static content only
        sendfile off;

        error_page 500 502 503 504 / 50x.html;
        location = /50x.html {
                        root   /usr / local / www / nginx - dist;
    }
    location / agenda
    {
        try_files $uri / agenda / index.php;
    }

     # Setup rewrite helper
     # These throw a lot of log warnings,
    I will probably disable them.
    rewrite ^  / parts / setup / webserver - test$ / parts / setup / tests / webservercheck.json;

     # Handle main / parts location to symfony app.php controller
    location / parts
    {
        try_files $uri $uri /  / parts / app.php ? $query_string;

    }

     # Handle / setup location to symfony setup.php controller
     # likely can be disabled upon deployment
    location / parts / setup /
    {
        try_files $uri $uri /  / parts / setup.php ? $query_string;
    }

    location~[ ^  / ] \ .php(/|$) {
                   try_files $uri =404;
                   fastcgi_split_path_info ^(.+\.php)(/. + )$;
    fastcgi_pass unix : /var/run / php - fpm.sock;
    fastcgi_index index.php;

     # only for setup(and increase timeout to 900)
     ## fastcgi_ignore_client_abort on;
     ## fastcgi_read_timeout 120;

    fastcgi_param SCRIPT_FILENAME $request_filename;

    include fastcgi_params;
    fastcgi_intercept_errors off;
    fastcgi_buffer_size 16k;
    fastcgi_buffers 4 16k;
}

location~ /  \ .git
{
    deny all;
}

 # Deny.ht * access
location~ /  \ .ht
{
    deny all;
}

}

}
nobicycle commented 7 years ago

I still have no success. 1) I am using the config in: https://wiki.partkeepr.org/wiki/KB00005:Web_Server_Configuration

The only lines changed: server_name partkeepr.localdomain; root /srv/http/partkeepr/web/;

I placed a testphp.php file in the above root and the following url works fine in a browser http://partkeepr.localdomain/testphp.php

I then browse to http://partkeepr.localdomain/setup/index.html

This is slightly different to the instructions given in https://github.com/partkeepr/PartKeepr/blob/master/documentation/Installation.md which states to browse to http://partkeepr.localdomain/web/setup/index.html . However the nginx config listed in 1) above sets the root to /var/www/partkeepr/web/; In which case the path should be just setup/index.html and not web/setup/index.html

Anyway, I get the messages below in the error log.

Regards

2016/08/15 23:15:18 [error] 20707#20707: 1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: partkeepr.localdomain, request: "POST /web/setup.php/setup/webserverTest HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "partkeepr.localdomain", referrer: "http://partkeepr.localdomain/web/setup/index.html" 2017/01/18 11:45:40 [error] 23503#23503: 1 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(/srv/http/partkeepr/web/../app/bootstrap.php.cache): failed to open stream: No such file or directory in /srv/http/partkeepr/web/app.php on line 6 PHP message: PHP Fatal error: require_once(): Failed opening required '/srv/http/partkeepr/web/../app/bootstrap.php.cache' (include_path='.:') in /srv/http/partkeepr/web/app.php on line 6" while reading response header from upstream, client: 127.0.0.1, server: partkeepr.localdomain, request: "GET /js/packages/extjs6/build/classic/theme-classic/resources/theme-classic-all.css HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "partkeepr.localdomain", referrer: "http://partkeepr.localdomain/setup/index.html" 2017/01/18 11:45:40 [error] 23503#23503: 3 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(/srv/http/partkeepr/web/../app/bootstrap.php.cache): failed to open stream: No such file or directory in /srv/http/partkeepr/web/app.php on line 6 PHP message: PHP Fatal error: require_once(): Failed opening required '/srv/http/partkeepr/web/../app/bootstrap.php.cache' (include_path='.:') in /srv/http/partkeepr/web/app.php on line 6" while reading response header from upstream, client: 127.0.0.1, server: partkeepr.localdomain, request: "GET /atelierspierrot/famfamfam-silk-sprite/silk-icons-sprite.css HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "partkeepr.localdomain", referrer: "http://partkeepr.localdomain/setup/index.html" 2017/01/18 11:45:40 [error] 23503#23503: 3 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(/srv/http/partkeepr/web/../app/bootstrap.php.cache): failed to open stream: No such file or directory in /srv/http/partkeepr/web/app.php on line 6 PHP message: PHP Fatal error: require_once(): Failed opening required '/srv/http/partkeepr/web/../app/bootstrap.php.cache' (include_path='.:') in /srv/http/partkeepr/web/app.php on line 6" while reading response header from upstream, client: 127.0.0.1, server: partkeepr.localdomain, request: "GET /js/packages/extjs6/build/ext-all-debug.js HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "partkeepr.localdomain", referrer: "http://partkeepr.localdomain/setup/index.html" 2017/01/18 11:45:40 [error] 23503#23503: *3 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(/srv/http/partkeepr/web/../app/bootstrap.php.cache): failed to open stream: No such file or directory in /srv/http/partkeepr/web/app.php on line 6 PHP message: PHP Fatal error: require_once(): Failed opening required '/srv/http/partkeepr/web/../app/bootstrap.php.cache' (include_path='.:') in /srv/http/partkeepr/web/app.php on line 6" while reading response header from upstream, client: 127.0.0.1, server: partkeepr.localdomain, request: "GET /bundles/partkeeprfrontend/images/favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "partkeepr.localdomain", referrer: "http://partkeepr.localdomain/setup/index.html"

christianlupus commented 4 years ago

Did you manage to get things working in the meantime, @nobicycle @watersAbove? It was quite some time since the last comment on the issue.

nobicycle commented 4 years ago

Thanks for the inquiry. Please close as too old. Did not resolve.