LEMP Server Set Up
###Move to site available directory
$ cd /etc/nginx/sites-available
$ sudo nano mynewsite.com
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/marcov4lente.com;
index index.php index.html index.htm index.nginx-debian.html;
server_name marcov4lente.com;
# enable rewrite
location / {
try_files $uri $uri/ /index.php?q=$request_uri;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
# deny access to .htaccess files
location ~ /\.ht {
deny all;
}
By symlinking it's configuration file to the sites-enabled folder:
ls -s /etc/nginx/sites-available/mynewsite.com /etc/nginx/sites-enabled/mynewsite.com
$ nginx -t
$ systemctl restart php7.0-fpm
$ systemctl restart php7.0-fpm
$ systemctl reload nginx
$ sudo apt-get update
$ sudo apt-get -y upgrade
$ sudo apt-get install -y nginx
$ ufw allow 'Nginx HTTP'
$ apt-get install -y mysql-server
$ sudo apt-get install -y php7.0
$ sudo apt-get install -y php-fpm
$ sudo apt-get install -y php-mysql
$ sudo apt-get install -y php-mbstring
$ sudo apt-get install -y php-gettext
$ sudo apt-get install -y php-xml
$ sudo apt-get install -y php-curl
$ nano /etc/php/7.0/fpm/php.ini
Set:
cgi.fix_pathinfo = 0
$ systemctl restart php7.0-fpm
$ systemctl reload nginx
$ apt-get install git
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
$ wget https://phar.phpunit.de/phpunit-6.0.phar
$ chmod +x phpunit-6.0.phar
$ sudo mv phpunit-6.0.phar /usr/local/bin/phpunit
$ phpunit --version