Q
Q
qjawko2018-07-31 14:55:35
PHP
qjawko, 2018-07-31 14:55:35

How to connect nginx and php-fpm?

When opening the root link (localhost:8080), the default Welcome to nginx page appears, and I want index.php. The php-fpm config files have been edited.

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

    index index.php index.htm index.html;

    #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       8080;
        server_name  localhost;
  
  access_log /var/log/nginx/access.log; 
  error_log /var/log/nginx/error.log;

  root /home/Qjawko/Documents/php;
        #charset koi8-r;

  location / {
        	try_files $uri $uri/ /index.php?$args;
    	}
 
    	location ~* \.php$ { 
    try_files $uri = 404; 
    include fastcgi_params;
 		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    fastcgi_pass unix:/run/php-fpm.sock;
 	}
  
  location ~ /\.ht { 
    deny all;
 	}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question