4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

NGINXWEB SERVER ON A RASPBERRY PI 3

We open the terminal and enter the following commands respectively
https://i.hizliresim.com/LO99po.png

$ 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 uriuriuri/ =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.

10 upvotes $0.00

Replies (3)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: