Difference between revisions of "User:Saul/nginx"

From Organic Design wiki
(Wordpress)
(Wordpress)
Line 52: Line 52:
 
grant all on example.com.* to 'USER' identified by 'PASSWORD'; # grant a user by the name of USER the permissions to modify the database with the password PASSWORD
 
grant all on example.com.* to 'USER' identified by 'PASSWORD'; # grant a user by the name of USER the permissions to modify the database with the password PASSWORD
 
quit; # exit mysql
 
quit; # exit mysql
 +
</source>
 +
== Nginx ==
 +
== Wordpress Install ==
 +
<source lang="bash">
 +
cd /var/www
 +
sudo rm -R html
 +
sudo mkdir public_html logs backups
 +
cd public_html
 +
sudo wget http://wordpress.org/latest.tar.gz # download the latest wordpress
 +
sudo -u www-data tar -xvf latest.tar.gz # extract it
 +
sudo mv latest.tar.gz ../backups/wordpress-`date "+%Y-%m-%d"`.tar.gz # archive the compressed folder OR just delete it
 +
sudo mv wordpress/* ./ # move the files out of the wordpress folder so the site will use them
 +
sudo rm -R wordpress # delete the old wordpress folder
 
</source>
 
</source>

Revision as of 06:18, 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

To use php change:

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;
        }

MySQL

Configure MySQL

sudo mysql_secure_installation # set a unique password, remove anonymous user accounts, disable remote root login, and remove the test database

Wordpress

MySQL

Create the database for wordpress:

mysql -u root -p # OR:
sudo mysql --user=root --password="ROOTPASSWORD" # Enter the MYSQL database
	create database example; # create the database example.com (can be anything) for wordpress
	create user 'USER' identified by 'PASSWORD'; # create a user by the name of USER with the password PASSWORD
	grant all on example.com.* to 'USER' identified by 'PASSWORD'; # grant a user by the name of USER the permissions to modify the database with the password PASSWORD
	quit; # exit mysql

Nginx

Wordpress Install

cd /var/www
sudo rm -R html
sudo mkdir public_html logs backups
cd public_html
sudo wget http://wordpress.org/latest.tar.gz # download the latest wordpress
sudo -u www-data tar -xvf latest.tar.gz # extract it
sudo mv latest.tar.gz ../backups/wordpress-`date "+%Y-%m-%d"`.tar.gz # archive the compressed folder OR just delete it
sudo mv wordpress/* ./ # move the files out of the wordpress folder so the site will use them
sudo rm -R wordpress # delete the old wordpress folder