You are not logged in.

#1 2021-07-07 09:08:03

3HHN
Member
Registered: 2021-07-07
Posts: 9

[Solved] [File not found] PHP+NGINX

Nginx + php-fpm after install these 2 packages and I applied php support to nginx.conf and after there is an error appeared on the page.

File not found

access.log

"GET /test.php HTTP/1.1" 404 27 "

nginx.conf

#user http;
worker_processes  1;

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

#pid        logs/nginx.pid;


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        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }
   location ~ \.php$ {
         fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
         fastcgi_index  index.php;
         root   /srv/http;
         include        fastcgi.conf;
    }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
}

Last edited by 3HHN (2021-07-08 05:17:26)

Offline

#2 2021-07-07 13:40:29

papajoke
Member
From: france
Registered: 2014-10-10
Posts: 28
Website

Re: [Solved] [File not found] PHP+NGINX

journalctl -u nginx -p3

not same root for php and other ?

Last edited by papajoke (2021-07-07 13:43:10)


lts - zsh - Kde - Intel Core i3 - 6Go RAM - GeForce 405 video-nouveau

Offline

#3 2021-07-07 14:17:05

3HHN
Member
Registered: 2021-07-07
Posts: 9

Re: [Solved] [File not found] PHP+NGINX

It's the same root.

Jul 02 15:46:12 UNIX nginx[389]: 2021/07/02 15:46:12 [warn] 389#389: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot cbce5779ee82470e9f658e300172f964 --
Jul 03 01:51:44 UNIX nginx[405]: 2021/07/03 01:51:44 [warn] 405#405: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot a6b4b743ea644083910a25fd107b0a3b --
Jul 03 01:51:46 UNIX nginx[392]: 2021/07/03 01:51:46 [warn] 392#392: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot 87a40aaff93840a0bea67b3cabbda0b8 --
Jul 03 07:30:06 UNIX nginx[384]: 2021/07/03 07:30:06 [warn] 384#384: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot 0a729b65bc9c4c5bb6eb58ec33d193a7 --
Jul 03 07:30:08 UNIX nginx[394]: 2021/07/03 07:30:08 [warn] 394#394: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot 6d3cd778b2664f53a9db9c0f4e37c916 --
Jul 03 19:20:04 UNIX nginx[397]: 2021/07/03 19:20:04 [warn] 397#397: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot c181f0ec60b749a8a8477b62b10a6eb8 --
Jul 04 11:56:09 UNIX nginx[395]: 2021/07/04 11:56:09 [warn] 395#395: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot 422fb9ac9fb343a6b7c680affad45c0a --
Jul 04 11:56:09 UNIX nginx[391]: 2021/07/04 11:56:09 [warn] 391#391: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot a04b4766dc1846b583a9b606cc01cc3d --
Jul 04 11:56:10 UNIX nginx[383]: 2021/07/04 11:56:09 [warn] 383#383: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot ea30a04d76fb46e2b27a9525a4650f2a --
Jul 05 02:29:02 UNIX nginx[392]: 2021/07/05 02:29:02 [warn] 392#392: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot 333322daea6b466182b050990d15d49b --
Jul 05 11:47:56 UNIX nginx[387]: 2021/07/05 11:47:56 [warn] 387#387: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot f2de87d62abf4906a7aa0c2ba0a72069 --
Jul 05 21:46:48 UNIX nginx[378]: 2021/07/05 21:46:48 [warn] 378#378: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot 17f08551436245c6a39a1f86485ef526 --
Jul 05 21:46:50 UNIX nginx[391]: 2021/07/05 21:46:49 [warn] 391#391: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot eab3d3399c7e4ab3bc886049a1ba7cf0 --
Jul 07 08:14:04 UNIX nginx[386]: 2021/07/07 08:14:04 [warn] 386#386: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
Jul 07 10:16:10 UNIX nginx[1749]: 2021/07/07 10:16:10 [warn] 1749#1749: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 10:16:55 UNIX nginx[1751]: 2021/07/07 10:16:55 [error] 1751#1751: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: loc>
Jul 07 10:18:32 UNIX nginx[1886]: 2021/07/07 10:18:32 [warn] 1886#1886: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 10:20:31 UNIX nginx[1946]: 2021/07/07 10:20:31 [warn] 1946#1946: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 10:20:41 UNIX nginx[1961]: 2021/07/07 10:20:41 [warn] 1961#1961: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 10:29:31 UNIX nginx[2126]: 2021/07/07 10:29:31 [warn] 2126#2126: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 10:37:06 UNIX nginx[2283]: 2021/07/07 10:37:06 [warn] 2283#2283: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 10:39:20 UNIX nginx[2416]: 2021/07/07 10:39:20 [warn] 2416#2416: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 10:43:12 UNIX nginx[2460]: 2021/07/07 10:43:12 [warn] 2460#2460: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 10:43:18 UNIX nginx[2480]: 2021/07/07 10:43:18 [warn] 2480#2480: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 10:43:34 UNIX nginx[2504]: 2021/07/07 10:43:34 [warn] 2504#2504: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 10:49:08 UNIX nginx[2568]: 2021/07/07 10:49:08 [emerg] 2568#2568: "worker_processes" directive is not allowed here in /etc/nginx/sites-enabled/new.conf:3
Jul 07 10:49:08 UNIX systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jul 07 10:50:17 UNIX nginx[2636]: 2021/07/07 10:50:17 [emerg] 2636#2636: "worker_processes" directive is not allowed here in /etc/nginx/sites-enabled/new.conf:3
Jul 07 10:50:17 UNIX systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jul 07 10:51:40 UNIX nginx[2697]: 2021/07/07 10:51:40 [warn] 2697#2697: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 10:54:36 UNIX nginx[2876]: 2021/07/07 10:54:36 [emerg] 2876#2876: "worker_processes" directive is not allowed here in /etc/nginx/sites-enabled/new.conf:3
Jul 07 10:54:36 UNIX systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jul 07 10:55:54 UNIX nginx[2926]: 2021/07/07 10:55:54 [warn] 2926#2926: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 11:16:55 UNIX nginx[3735]: 2021/07/07 11:16:55 [emerg] 3735#3735: "worker_processes" directive is not allowed here in /etc/nginx/sites-enabled/new.conf:3
Jul 07 11:16:55 UNIX systemd[1]: Failed to start A high performance web server and a reverse proxy server.

Offline

#4 2021-07-07 14:31:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,378

Re: [Solved] [File not found] PHP+NGINX

3HHN wrote:

It's the same root.

Not according to the config file it isn't.  I was wondering the same thing - I'd not define 'root' in a location block, but just in the server block.

I'd also suggest removing the excess commented content and perhaps fixing the indentation of your config - these would make it much easier for others to read and provide help.  And please edit your post(s) to replace the "quote" tags with "code" tags.

Last edited by Trilby (2021-07-07 14:33:34)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2021-07-07 15:20:45

3HHN
Member
Registered: 2021-07-07
Posts: 9

Re: [Solved] [File not found] PHP+NGINX

Jul 07 12:35:54 UNIX systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jul 07 12:39:01 UNIX nginx[6247]: 2021/07/07 12:39:01 [emerg] 6247#6247: unexpected end of file, expecting "}" in /etc/nginx/nginx.conf:137
Jul 07 12:39:01 UNIX systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jul 07 12:39:29 UNIX nginx[6270]: 2021/07/07 12:39:29 [warn] 6270#6270: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 12:41:46 UNIX nginx[6320]: 2021/07/07 12:41:46 [warn] 6320#6320: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 12:41:51 UNIX nginx[6322]: 2021/07/07 12:41:51 [error] 6322#6322: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: loc>
Jul 07 12:42:08 UNIX nginx[6413]: 2021/07/07 12:42:07 [warn] 6413#6413: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 12:42:49 UNIX nginx[6415]: 2021/07/07 12:42:49 [error] 6415#6415: *2 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: loc>
Jul 07 12:44:22 UNIX nginx[6833]: 2021/07/07 12:44:22 [warn] 6833#6833: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 12:44:25 UNIX nginx[6835]: 2021/07/07 12:44:25 [error] 6835#6835: *1 "/webroot/annie/web/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: localhos>
Jul 07 12:44:27 UNIX nginx[6835]: 2021/07/07 12:44:27 [error] 6835#6835: *2 "/webroot/annie/web/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: localhos>
Jul 07 12:45:12 UNIX nginx[6883]: 2021/07/07 12:45:12 [emerg] 6883#6883: location "/50x.html" is outside location "\.php$" in /etc/nginx/nginx.conf:72
Jul 07 12:45:12 UNIX systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jul 07 12:47:44 UNIX nginx[6947]: 2021/07/07 12:47:44 [warn] 6947#6947: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 12:48:18 UNIX nginx[6949]: 2021/07/07 12:48:18 [error] 6949#6949: *1 "/webroot/annie/web/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: localhos>
Jul 07 12:48:29 UNIX nginx[6949]: 2021/07/07 12:48:29 [error] 6949#6949: *1 open() "/etc/nginx/html/test.php" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, r>
Jul 07 12:48:31 UNIX nginx[6949]: 2021/07/07 12:48:31 [error] 6949#6949: *1 open() "/etc/nginx/html/test.php" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, r>
Jul 07 12:50:16 UNIX nginx[7016]: 2021/07/07 12:50:16 [warn] 7016#7016: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 12:50:26 UNIX nginx[7050]: 2021/07/07 12:50:26 [warn] 7050#7050: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 12:50:46 UNIX nginx[7052]: 2021/07/07 12:50:46 [error] 7052#7052: *1 open() "/webroot/annie/web/1.txt" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, r>
Jul 07 12:51:15 UNIX nginx[7089]: 2021/07/07 12:51:15 [warn] 7089#7089: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 12:56:54 UNIX nginx[7489]: 2021/07/07 12:56:54 [warn] 7489#7489: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 12:57:14 UNIX nginx[7491]: 2021/07/07 12:57:14 [error] 7491#7491: *1 open() "/usr/share/nginx/html/1.txt" failed (2: No such file or directory), client: 127.0.0.1, server: localhost>
Jul 07 12:57:40 UNIX nginx[7536]: 2021/07/07 12:57:40 [warn] 7536#7536: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 12:57:54 UNIX nginx[7538]: 2021/07/07 12:57:54 [error] 7538#7538: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 12:58:11 UNIX nginx[7538]: 2021/07/07 12:58:11 [error] 7538#7538: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 12:58:12 UNIX nginx[7538]: 2021/07/07 12:58:12 [error] 7538#7538: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:00:51 UNIX nginx[7686]: 2021/07/07 13:00:51 [warn] 7686#7686: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:01:02 UNIX nginx[7688]: 2021/07/07 13:01:02 [error] 7688#7688: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:01:04 UNIX nginx[7688]: 2021/07/07 13:01:04 [error] 7688#7688: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:01:05 UNIX nginx[7688]: 2021/07/07 13:01:05 [error] 7688#7688: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:02:37 UNIX nginx[7819]: 2021/07/07 13:02:37 [warn] 7819#7819: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:02:46 UNIX nginx[7821]: 2021/07/07 13:02:46 [error] 7821#7821: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:02:49 UNIX nginx[7821]: 2021/07/07 13:02:49 [error] 7821#7821: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:03:49 UNIX nginx[7901]: 2021/07/07 13:03:49 [warn] 7901#7901: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:05:03 UNIX nginx[7941]: 2021/07/07 13:05:03 [emerg] 7941#7941: unexpected end of file, expecting "}" in /etc/nginx/nginx.conf:77
Jul 07 13:05:03 UNIX systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jul 07 13:06:15 UNIX nginx[7986]: 2021/07/07 13:06:15 [warn] 7986#7986: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:06:20 UNIX nginx[7988]: 2021/07/07 13:06:20 [error] 7988#7988: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:06:21 UNIX nginx[7988]: 2021/07/07 13:06:21 [error] 7988#7988: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:07:35 UNIX nginx[8036]: 2021/07/07 13:07:35 [warn] 8036#8036: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:07:38 UNIX nginx[8038]: 2021/07/07 13:07:38 [error] 8038#8038: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:07:51 UNIX nginx[8074]: 2021/07/07 13:07:51 [warn] 8074#8074: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:07:54 UNIX nginx[8076]: 2021/07/07 13:07:54 [error] 8076#8076: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:08:00 UNIX nginx[8076]: 2021/07/07 13:08:00 [error] 8076#8076: *1 "/webroot/annie/web/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: localhos>
Jul 07 13:08:11 UNIX nginx[8076]: 2021/07/07 13:08:11 [error] 8076#8076: *1 open() "/webroot/annie/web/1.txt" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, r>
Jul 07 13:08:14 UNIX nginx[8076]: 2021/07/07 13:08:14 [error] 8076#8076: *1 open() "/webroot/annie/web/1.txt" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, r>
Jul 07 13:08:51 UNIX nginx[8120]: 2021/07/07 13:08:51 [warn] 8120#8120: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:08:59 UNIX nginx[8122]: 2021/07/07 13:08:59 [error] 8122#8122: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:09:00 UNIX nginx[8122]: 2021/07/07 13:09:00 [error] 8122#8122: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:12:29 UNIX nginx[8237]: 2021/07/07 13:12:29 [warn] 8237#8237: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:12:32 UNIX nginx[8242]: 2021/07/07 13:12:32 [error] 8242#8242: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:13:01 UNIX nginx[8282]: 2021/07/07 13:13:01 [warn] 8282#8282: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:13:05 UNIX nginx[8284]: 2021/07/07 13:13:05 [crit] 8284#8284: *1 realpath() "/etc/nginx/html" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request>
Jul 07 13:13:05 UNIX nginx[8284]: 2021/07/07 13:13:05 [error] 8284#8284: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:16:11 UNIX nginx[8284]: 2021/07/07 13:16:11 [crit] 8284#8284: *3 realpath() "/etc/nginx/html" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request>
Jul 07 13:16:11 UNIX nginx[8284]: 2021/07/07 13:16:11 [error] 8284#8284: *3 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:16:25 UNIX nginx[8284]: 2021/07/07 13:16:25 [crit] 8284#8284: *3 realpath() "/etc/nginx/html" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request>
Jul 07 13:16:25 UNIX nginx[8284]: 2021/07/07 13:16:25 [error] 8284#8284: *3 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:17:32 UNIX nginx[8284]: 2021/07/07 13:17:32 [error] 8284#8284: *6 directory index of "/webroot/annie/www/" is forbidden, client: 127.0.0.1, server: localhost, request: "GET / HTT>
Jul 07 13:18:26 UNIX nginx[8535]: 2021/07/07 13:18:26 [warn] 8535#8535: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:18:33 UNIX nginx[8537]: 2021/07/07 13:18:33 [error] 8537#8537: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:19:09 UNIX nginx[8574]: 2021/07/07 13:19:09 [warn] 8574#8574: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:19:12 UNIX nginx[8576]: 2021/07/07 13:19:12 [error] 8576#8576: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:22:18 UNIX nginx[8638]: 2021/07/07 13:22:18 [warn] 8638#8638: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:22:21 UNIX nginx[8640]: 2021/07/07 13:22:21 [error] 8640#8640: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:22:22 UNIX nginx[8640]: 2021/07/07 13:22:22 [error] 8640#8640: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:22:23 UNIX nginx[8640]: 2021/07/07 13:22:23 [error] 8640#8640: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:22:23 UNIX nginx[8640]: 2021/07/07 13:22:23 [error] 8640#8640: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:22:24 UNIX nginx[8640]: 2021/07/07 13:22:24 [error] 8640#8640: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:26:46 UNIX nginx[8640]: 2021/07/07 13:26:46 [error] 8640#8640: *7 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:26:48 UNIX nginx[8640]: 2021/07/07 13:26:48 [error] 8640#8640: *7 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:26:48 UNIX nginx[8640]: 2021/07/07 13:26:48 [error] 8640#8640: *7 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:26:49 UNIX nginx[8640]: 2021/07/07 13:26:49 [error] 8640#8640: *7 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 13:28:00 UNIX nginx[8943]: 2021/07/07 13:28:00 [warn] 8943#8943: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:28:15 UNIX nginx[8945]: 2021/07/07 13:28:15 [error] 8945#8945: *1 open() "/usr/share/nginx/html/test.php" failed (2: No such file or directory), client: 127.0.0.1, server: localh>
Jul 07 13:30:07 UNIX nginx[9033]: 2021/07/07 13:30:07 [warn] 9033#9033: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:40:00 UNIX nginx[9545]: 2021/07/07 13:40:00 [warn] 9545#9545: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:45:03 UNIX nginx[9878]: 2021/07/07 13:45:03 [warn] 9878#9878: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 13:45:03 UNIX nginx[9878]: 2021/07/07 13:45:03 [emerg] 9878#9878: open() "/etc/nginx/logs/error.log" failed (2: No such file or directory)
Jul 07 13:45:03 UNIX systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Boot c60862ad3de949ea9a7cfbab42905bbb --
Jul 07 14:07:07 UNIX nginx[390]: 2021/07/07 14:07:06 [warn] 390#390: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
Jul 07 14:13:45 UNIX nginx[997]: 2021/07/07 14:13:45 [emerg] 997#997: "server" directive is not allowed here in /etc/nginx/nginx.conf:1
Jul 07 14:13:45 UNIX systemd[1]: Reload failed for A high performance web server and a reverse proxy server.
Jul 07 14:15:40 UNIX nginx[1026]: 2021/07/07 14:15:40 [emerg] 1026#1026: "server" directive is not allowed here in /etc/nginx/nginx.conf:1
Jul 07 14:15:40 UNIX systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jul 07 14:19:38 UNIX nginx[1197]: 2021/07/07 14:19:38 [warn] 1197#1197: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 14:19:48 UNIX nginx[1199]: 2021/07/07 14:19:48 [error] 1199#1199: *2 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:22:11 UNIX nginx[1354]: 2021/07/07 14:22:11 [warn] 1354#1354: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 14:22:11 UNIX nginx[1354]: 2021/07/07 14:22:11 [warn] 1354#1354: conflicting server name "localhost" on 0.0.0.0:80, ignored
Jul 07 14:22:39 UNIX nginx[1379]: 2021/07/07 14:22:39 [warn] 1379#1379: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 14:22:58 UNIX nginx[1381]: 2021/07/07 14:22:58 [error] 1381#1381: *1 open() "/usr/share/nginx/html/44" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, r>
Jul 07 14:23:38 UNIX nginx[1443]: 2021/07/07 14:23:38 [warn] 1443#1443: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 14:23:51 UNIX nginx[1445]: 2021/07/07 14:23:51 [error] 1445#1445: *1 directory index of "/webroot/annie/www/" is forbidden, client: 127.0.0.1, server: localhost, request: "GET / HTT>
Jul 07 14:23:51 UNIX nginx[1445]: 2021/07/07 14:23:51 [error] 1445#1445: *1 open() "/webroot/annie/www/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: localh>
Jul 07 14:33:37 UNIX nginx[1735]: 2021/07/07 14:33:37 [warn] 1735#1735: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 14:33:46 UNIX nginx[1737]: 2021/07/07 14:33:46 [error] 1737#1737: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:33:48 UNIX nginx[1737]: 2021/07/07 14:33:48 [error] 1737#1737: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:33:55 UNIX nginx[1737]: 2021/07/07 14:33:55 [error] 1737#1737: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:37:12 UNIX nginx[1910]: 2021/07/07 14:37:12 [warn] 1910#1910: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 14:37:12 UNIX nginx[1910]: 2021/07/07 14:37:12 [notice] 1910#1910: signal process started
Jul 07 14:37:24 UNIX nginx[1914]: 2021/07/07 14:37:24 [error] 1914#1914: *8 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:37:26 UNIX nginx[1914]: 2021/07/07 14:37:26 [error] 1914#1914: *8 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
-- Boot 8a1cfed46d90472fbf0c54c08bcd5b19 --
Jul 07 14:46:11 UNIX nginx[1566]: 2021/07/07 14:46:11 [warn] 1566#1566: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 14:46:19 UNIX nginx[1580]: 2021/07/07 14:46:19 [warn] 1580#1580: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 14:46:19 UNIX nginx[1580]: 2021/07/07 14:46:19 [notice] 1580#1580: signal process started
Jul 07 14:46:58 UNIX nginx[1584]: 2021/07/07 14:46:58 [crit] 1584#1584: *1 connect() to unix:/var/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstrea>
Jul 07 14:47:26 UNIX nginx[1602]: 2021/07/07 14:47:26 [warn] 1602#1602: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 14:48:07 UNIX nginx[1604]: 2021/07/07 14:48:07 [crit] 1604#1604: *1 connect() to unix:/var/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstrea>
Jul 07 14:48:20 UNIX nginx[1604]: 2021/07/07 14:48:20 [crit] 1604#1604: *1 connect() to unix:/var/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstrea>
Jul 07 14:48:22 UNIX nginx[1604]: 2021/07/07 14:48:22 [crit] 1604#1604: *1 connect() to unix:/var/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstrea>
Jul 07 14:50:01 UNIX nginx[1604]: 2021/07/07 14:50:01 [crit] 1604#1604: *5 connect() to unix:/var/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstrea>
Jul 07 14:50:02 UNIX nginx[1604]: 2021/07/07 14:50:02 [error] 1604#1604: *5 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: loc>
Jul 07 14:50:03 UNIX nginx[1604]: 2021/07/07 14:50:03 [crit] 1604#1604: *7 connect() to unix:/var/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstrea>
Jul 07 14:50:16 UNIX nginx[1604]: 2021/07/07 14:50:16 [crit] 1604#1604: *7 connect() to unix:/var/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstrea>
-- Boot ff9520228027449fa3d9f03f47cd6e57 --
Jul 07 14:50:22 UNIX nginx[384]: 2021/07/07 14:50:22 [warn] 384#384: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
Jul 07 14:51:17 UNIX nginx[415]: 2021/07/07 14:51:17 [error] 415#415: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, se>
Jul 07 14:51:19 UNIX nginx[415]: 2021/07/07 14:51:19 [error] 415#415: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, se>
Jul 07 14:55:56 UNIX nginx[1217]: 2021/07/07 14:55:56 [warn] 1217#1217: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 14:56:08 UNIX nginx[1219]: 2021/07/07 14:56:08 [error] 1219#1219: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:56:08 UNIX nginx[1219]: 2021/07/07 14:56:08 [error] 1219#1219: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:56:09 UNIX nginx[1219]: 2021/07/07 14:56:09 [error] 1219#1219: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:56:09 UNIX nginx[1219]: 2021/07/07 14:56:09 [error] 1219#1219: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:56:09 UNIX nginx[1219]: 2021/07/07 14:56:09 [error] 1219#1219: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:56:09 UNIX nginx[1219]: 2021/07/07 14:56:09 [error] 1219#1219: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:56:09 UNIX nginx[1219]: 2021/07/07 14:56:09 [error] 1219#1219: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:56:10 UNIX nginx[1219]: 2021/07/07 14:56:10 [error] 1219#1219: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:57:01 UNIX nginx[1281]: 2021/07/07 14:57:01 [warn] 1281#1281: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 14:57:14 UNIX nginx[1283]: 2021/07/07 14:57:14 [error] 1283#1283: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:57:15 UNIX nginx[1283]: 2021/07/07 14:57:15 [error] 1283#1283: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:57:22 UNIX nginx[1283]: 2021/07/07 14:57:22 [error] 1283#1283: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:58:07 UNIX nginx[1283]: 2021/07/07 14:58:07 [error] 1283#1283: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 14:59:30 UNIX nginx[1283]: 2021/07/07 14:59:30 [error] 1283#1283: *6 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: loc>
Jul 07 14:59:35 UNIX nginx[1283]: 2021/07/07 14:59:35 [error] 1283#1283: *6 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
-- Boot 0ed8654160b24f6cbae3fcc0393c1393 --
Jul 07 15:08:32 UNIX nginx[399]: 2021/07/07 15:08:31 [warn] 399#399: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot fe4119c3326e499f83f89da9a149c670 --
Jul 07 15:08:32 UNIX nginx[389]: 2021/07/07 15:08:31 [warn] 389#389: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
-- Boot 5e87b1753e874aaeb474163c2fcd4664 --
Jul 07 16:46:38 UNIX nginx[401]: 2021/07/07 16:46:38 [warn] 401#401: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>
Jul 07 18:27:29 UNIX nginx[1328]: 2021/07/07 18:27:29 [warn] 1328#1328: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: >
Jul 07 18:27:54 UNIX nginx[1330]: 2021/07/07 18:27:54 [error] 1330#1330: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: loc>
Jul 07 18:28:05 UNIX nginx[1330]: 2021/07/07 18:28:05 [error] 1330#1330: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 18:28:07 UNIX nginx[1330]: 2021/07/07 18:28:07 [error] 1330#1330: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 18:28:08 UNIX nginx[1330]: 2021/07/07 18:28:08 [error] 1330#1330: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 18:28:09 UNIX nginx[1330]: 2021/07/07 18:28:09 [error] 1330#1330: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 18:28:10 UNIX nginx[1330]: 2021/07/07 18:28:10 [error] 1330#1330: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
Jul 07 19:12:02 UNIX nginx[1330]: 2021/07/07 19:12:02 [error] 1330#1330: *7 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1,>
-- Boot 535617bd010e41df998c4652cac0027d --
Jul 07 19:47:48 UNIX nginx[400]: 2021/07/07 19:47:48 [warn] 400#400: could not build optimal types_hash, you should increase either types_hash_max_size: 1024 or types_hash_bucket_size: 64;>

Offline

#6 2021-07-07 17:41:17

jonno2002
Member
Registered: 2016-11-21
Posts: 187

Re: [Solved] [File not found] PHP+NGINX

without knowing whats in the fastcgi.conf file, i just binned that section of your config file and added one that should work, and fixed the root issue too

    worker_processes  1;

    events {
        worker_connections  1024;
    }

    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile      on;
        keepalive_timeout  65;

        server {
            listen       80;
            server_name  localhost;
            root   /srv/http;

            location / {
                index  index.html index.htm index.php;
            }
            
	    location ~ [^/]\.(php|html|htm)(/|$) {
                # Correctly handle request like /test.php/foo/blah.php or /test.php/
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;

                try_files $uri $document_root$fastcgi_script_name =404;

                # Mitigate https://httpoxy.org/ vulnerabilities
                fastcgi_param HTTP_PROXY "";

                fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
            }
	}
    }

Offline

#7 2021-07-07 17:50:56

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,378

Re: [Solved] [File not found] PHP+NGINX

From the new log in post #5, the problem was certainly related to the 'root' setting as nginx is looking for the test.php file at /etc/nginx/html/ and /usr/share/nginx/html/.  Later in the log, it also looks like php-fpm may not even be running.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2021-07-08 01:14:11

3HHN
Member
Registered: 2021-07-07
Posts: 9

Re: [Solved] [File not found] PHP+NGINX

I've touched a text file at same directory for test, and there are no any issue with .txt, but when I tried to load phpinfo(); it doesn't work as well.

Offline

#9 2021-07-08 01:24:39

3HHN
Member
Registered: 2021-07-07
Posts: 9

Re: [Solved] [File not found] PHP+NGINX

the config file from #6 doesn't work as well.

Offline

#10 2021-07-08 01:46:59

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,378

Re: [Solved] [File not found] PHP+NGINX

3HHN wrote:

I've touched a text file at same directory for test, and there are no any issue with .txt

There SHOULD be issues with that!  The nginx.conf file you've shared wouldn't even try to load a .txt file and a .php file from the same directory.  Clearly there is much we are not being told here.

What actual directory are the .php and .txt file in?  When it "doesn't work" post the actual config that was in use at that time and the log output for that session.

Last edited by Trilby (2021-07-08 01:47:14)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#11 2021-07-08 04:49:40

3HHN
Member
Registered: 2021-07-07
Posts: 9

Re: [Solved] [File not found] PHP+NGINX

Here is the new config file

#user http;
worker_processes  1;

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

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

    #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        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }
        location ~ \.php$ {
        # 404
        try_files $fastcgi_script_name =404;

        # default fastcgi_params
        include fastcgi_params;

        # fastcgi settings
        fastcgi_pass                    unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index                   index.php;
        fastcgi_buffers                 8 16k;
        fastcgi_buffer_size             32k;

        # fastcgi params
        fastcgi_param DOCUMENT_ROOT     $realpath_root;
        fastcgi_param SCRIPT_FILENAME   $realpath_root$fastcgi_script_name;
        #fastcgi_param PHP_ADMIN_VALUE  "open_basedir=$base/:/usr/lib/php/:/tmp/";
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

Sorry I've posted wrong file at the beginning.

Last edited by 3HHN (2021-07-08 05:17:59)

Offline

#12 2021-07-08 05:16:32

3HHN
Member
Registered: 2021-07-07
Posts: 9

Re: [Solved] [File not found] PHP+NGINX

I've solved the problem.
It's working now, I put the configuration at wrong section.
Thanks a lot for the help.

Last edited by 3HHN (2021-07-08 05:18:51)

Offline

Board footer

Powered by FluxBB