User Tools

Site Tools


nginx_serverblock

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
nginx_serverblock [2015/04/04 16:52] luke7858nginx_serverblock [2024/05/23 07:26] (current) – external edit 127.0.0.1
Line 1: Line 1:
-First we need to **/etc/nginx/nginx.conf** to allow virtual hosts (known as server blocks when using nginx)+=== Basic HTTP-only nginx server_block === 
 +\\ 
 +First we need to edit **/etc/nginx/nginx.conf** to allow virtual hosts (known as server blocks when using nginx)
 This guide will show how to configure server blocks in the same manner as Ubuntu apache vhosts, using sites-available and sites-enabled. This guide will show how to configure server blocks in the same manner as Ubuntu apache vhosts, using sites-available and sites-enabled.
 \\ \\
Line 22: Line 24:
     server_name lukeshirnia.co.uk www.lukeshirnia.co.uk;     server_name lukeshirnia.co.uk www.lukeshirnia.co.uk;
     access_log /var/log/nginx/lukeshirnia.co.uk.access.log;     access_log /var/log/nginx/lukeshirnia.co.uk.access.log;
-    error_log /var/log/nginx/lukeshirnia.co.uk.access.log;+    error_log /var/log/nginx/lukeshirnia.co.uk.error.log;
     root /var/www/html/lukeshirnia.co.uk;     root /var/www/html/lukeshirnia.co.uk;
  
 location / { location / {
     index index.html index.htm index.php;     index index.html index.htm index.php;
 +    try_files $uri $uri/ =404;
 } }
  
 location ~ \.php$ { location ~ \.php$ {
     include /etc/nginx/fastcgi_params;     include /etc/nginx/fastcgi_params;
-    fastcgi_pass  127.0.0.1:9000;+    fastcgi_pass  127.0.0.1:9000; #this means php-fpm will run on a port 
 +    # fastcgi_pass unix:/run/php-fpm/example.com.sock; or you could have php-fpm running on a socket
     fastcgi_index index.php;     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME /var/www/html/lukeshirnia.co.uk$fastcgi_script_name;     fastcgi_param SCRIPT_FILENAME /var/www/html/lukeshirnia.co.uk$fastcgi_script_name;
nginx_serverblock.1428166379.txt.gz · Last modified: 2024/05/23 07:26 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki