Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: PHP7 & Nginx & Ubuntu ściąga info.php
Forum PHP.pl > Forum > Serwery WWW
Szkatu
Witajcie na początku chcę zaznaczyć, że szlak mnie trafia. Siedzę od paru godzin nad pierdołą dosłownie. Chcę postawić serwer na Ubuntu. Zainstalowałem to na virtualboxie.
Zainstalowałem Nginx, PHP 7 . Podmieniłem ścieżkę w pliku sudo nano /etc/nginx/sites-enabled/default . Utworzyłem we właściwym katalogu plik info.php z funkcją i do jasnej cholery zamiast go wyświetlić
to pobiera exclamation.gif!! Znalazłem problemy podobne w google, ale kombinuje, kombinuje i nic. Dodam, że to mój pierwszy serwer na linux i Nginx. Czy może mi ktoś po kolei łopatologicznie wyjaśnić, jak to zrobić ?
Wklejam tu cały ten plik

Pozdrawiam


  1. # You may add here your
  2. # server {
  3. # ...
  4. # }
  5. # statements for each of your virtual hosts to this file
  6.  
  7. ##
  8. # You should look at the following URL's in order to grasp a solid understanding
  9. # of Nginx configuration files in order to fully unleash the power of Nginx.
  10. # <a href="http://wiki.nginx.org/Pitfalls" target="_blank">http://wiki.nginx.org/Pitfalls</a>
  11. # <a href="http://wiki.nginx.org/QuickStart" target="_blank">http://wiki.nginx.org/QuickStart</a>
  12. # <a href="http://wiki.nginx.org/Configuration" target="_blank">http://wiki.nginx.org/Configuration</a>
  13. #
  14. # Generally, you will want to move this file somewhere, and start with a clean
  15. # file but keep this around for reference. Or just disable in sites-enabled.
  16. #
  17. # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
  18. ##
  19.  
  20. server {
  21. listen 80 default_server;
  22. listen [::]:80 default_server ipv6only=on;
  23.  
  24. root /usr/share/nginx/html;
  25. index index.html index.htm;
  26.  
  27. # Make site accessible from <a href="http://localhost/" target="_blank">http://localhost/</a>
  28. server_name localhost;
  29.  
  30. location / {
  31. # First attempt to serve request as file, then
  32. # as directory, then fall back to displaying a 404.
  33. try_files $uri $uri/ =404;
  34. # Uncomment to enable naxsi on this location
  35. # include /etc/nginx/naxsi.rules
  36. }
  37.  
  38. # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
  39. #location /RequestDenied {
  40. # proxy_pass <a href="http://127.0.0.1:8080;" target="_blank">http://127.0.0.1:8080;</a>
  41. #}
  42.  
  43. #error_page 404 /404.html;
  44.  
  45. # redirect server error pages to the static page /50x.html
  46. #
  47. #error_page 500 502 503 504 /50x.html;
  48. #location = /50x.html {
  49. # root /usr/share/nginx/html;
  50. #}
  51.  
  52. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  53. #
  54. #location ~ \.php$ {
  55. # fastcgi_split_path_info ^(.+\.php)(/.+)$;
  56. # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  57. #
  58. # # With php5-cgi alone:
  59. # fastcgi_pass 127.0.0.1:9000;
  60. # # With php5-fpm:
  61. # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
  62. # fastcgi_index index.php;
  63. # include fastcgi_params;
  64. #}
  65.  
  66. # deny access to .htaccess files, if Apache's document root
  67. # concurs with nginx's one
  68. #
  69. #location ~ /\.ht {
  70. # deny all;
  71. #}
  72. }
  73.  
  74.  
  75. # another virtual host using mix of IP-, name-, and port-based configuration
  76. #
  77. #server {
  78. # listen 8000;
  79. # listen somename:8080;
  80. # server_name somename alias another.alias;
  81. # root html;
  82. # index index.html index.htm;
  83. #
  84. # location / {
  85. # try_files $uri $uri/ =404;
  86. # }
  87. #}
  88.  
  89.  
  90. # HTTPS server
  91. #
  92. #server {
  93. # listen 443;
  94. # server_name localhost;
  95. #
  96. # root html;
  97. # index index.html index.htm;
  98. #
  99. # ssl on;
  100. # ssl_certificate cert.pem;
  101. # ssl_certificate_key cert.key;
  102. #
  103. # ssl_session_timeout 5m;
  104. #
  105. # ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
  106. # ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
  107. # ssl_prefer_server_ciphers on;
  108. #
  109. # location / {
  110. # try_files $uri $uri/ =404;
  111. # }
  112. #}

ohm
Odkomentuj blok
Kod
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    
        # With php5-cgi alone:
    #    fastcgi_pass 127.0.0.1:9000;
        # With php5-fpm:
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }


Najprawdopodobniej masz fpm odpalony na sockecie, ale sprawdź dokładniej
Kod
find /var/run -name "*php*"

Szkatu
Witaj, no cóż nerwy nie są dobrym doradcą - taka głupota, po prostu nie właściwie wykomentowałem to . Dzięki za pomoc. PZDR
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.