Difference between revisions of "User:Saul/nginx"

From Organic Design wiki
(PHP)
(LEMP Stack)
Line 1: Line 1:
 
= LEMP Stack =
 
= LEMP Stack =
== Nginx ==
+
== Install ==
 +
=== Nginx ===
 
<source lang="bash">
 
<source lang="bash">
 
sudo apt-get install nginx
 
sudo apt-get install nginx
 
</source>
 
</source>
  
== PHP ==
+
=== PHP ===
 
<source lang="bash">
 
<source lang="bash">
 
sudo apt-get install php7.0 php7.0-fpm
 
sudo apt-get install php7.0 php7.0-fpm
 
</source>
 
</source>
  
== MySQL ==
+
=== MySQL ===
 
<source lang="bash">
 
<source lang="bash">
 
sudo apt-get install mysql-server php7.0-mysql
 
sudo apt-get install mysql-server php7.0-mysql
 +
</source>
 +
 +
== Configure ==
 +
=== Nginx ===
 +
<source lang="bash">
 +
sudo nano /etc/nginx/sites-enabled/default
 +
# Add index.php to the list if you are using PHP
 +
index index.html index.htm index.nginx-debian.html index.php;
 +
 +
# pass PHP scripts to FastCGI server
 +
        #
 +
        location ~ \.php$ {
 +
                include snippets/fastcgi-php.conf;
 +
 +
                # With php-fpm (or other unix sockets):
 +
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
 +
        #      # With php-cgi (or other tcp sockets):
 +
        #      fastcgi_pass 127.0.0.1:9000;
 +
        }
 
</source>
 
</source>
  
 
= Wordpress =
 
= Wordpress =

Revision as of 06:07, 17 September 2018

LEMP Stack

Install

Nginx

sudo apt-get install nginx

PHP

sudo apt-get install php7.0 php7.0-fpm

MySQL

sudo apt-get install mysql-server php7.0-mysql

Configure

Nginx

sudo nano /etc/nginx/sites-enabled/default
	# Add index.php to the list if you are using PHP
	index index.html index.htm index.nginx-debian.html index.php;

	# pass PHP scripts to FastCGI server
        #
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        }

Wordpress