Whenever you need to run a website you will need something to run it on so you will be able to published to the web. Nginx (pronounced "engine x") is a web and reverse-proxyserver which you can use to make your content visible to the web.
In just a few steps Nginx is installed and with it`s script-like config it is easy to maintain.
With the following steps you will have Nginx setup with PHP 7 in no time!
# sudo apt update # sudo apt install nginx # sudo service nginx start # sudo apt install php7.0-fpm
Open /etc/nginx/sites-available/default to configure Nginx with php-fpm support.
# sudo nano /etc/nginx/sites-available/default
Uncomment and make sure 'location' has the following values:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
Make sure .htacces is private
location ~ /\.ht {
deny all;
}
Hit 'ctrl + x' and afterwards 'enter' to save the contents to disk.
Now reload php-fpm and nginx for the new configuration to take effect.
# sudo service nginx reload # sudo service php7.0-fpm reload
Create a new file '/var/www/html/info.php in the webroot.
# sudo nano /var/www/html/info.php
With the following contents:
<?php
phpinfo();
?>
When all went wel and you go to http://instance-adres/info.php you should see the following:
Comments
0 comments
Please sign in to leave a comment.