NGINXWEB SERVER ON A RASPBERRY PI 3

in #nginx7 years ago (edited)

We open the terminal and enter the following commands respectively

$ sudo apt-get update -y
$ sudo apt-get upgrade -y
$ sudo apt-get dist-upgrade -y

#sudo apt-get install -y rpi-update // not important
#sudo apt-get install php libapache2-mod-php -y //For apache web server

$ sudo aptitude install nginx php-fpm -y //Ngınx web server

Then;
Configure The Nginx Web Server

$ sudo nano /etc/nginx/sites-enabled/default
#Changing


Default server

server {
listen 80 default_server;
listen [::]:80 default_server;

server_name _;
root /var/www/html;
index index.php index.html index.htm;
location / {
    try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server
location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
# optimize static file serving
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
    access_log off;
    log_not_found off;
    expires 30d;
}
# deny access to .htaccess files, should an Apache document root conflict with nginx
location ~ /\.ht {
    deny all;
}}

After That; We also need to install MySQL for database operations on our web server
$ sudo apt-get install mysql-server -y #Mysql Server

$ sudo apt-get install mysql-client -y #Mysql Client
#After you have installed the Mysql, you will have to make security settings.
$ sudo mysql_secure_installation
#However, in order to make our database operations even easier, we have phpMyAdmin policy to our server.
$ sudo apt-get install phpmyadmin

$ sudo ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin
#If you have successfully completed all steps, you will have folders in /var/www/html. All the html php files related to our web server are required to run under html.For this reason we need to define this folder authority.

$ sudo chown www-data:www-data -R /var/www/html
$ sudo chmod g+rw -R /var/www/html
$ sudo chmod g+s -R /var/www/html
$ sudo usermod -a -G www-data p

We completed the installation by typing the commands in order.

Sort:  

Congratulations @backend! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You published your First Post
You made your First Vote
You got a First Vote
Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

The @OriginalWorks bot has determined this post by @backend to be original material and upvoted it!

ezgif.com-resize.gif

To call @OriginalWorks, simply reply to any post with @originalworks or !originalworks in your message!

Coin Marketplace

STEEM 0.19
TRX 0.18
JST 0.032
BTC 88139.36
ETH 3066.37
USDT 1.00
SBD 2.76