• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

instaling nginx on debian 8

kafo

Well-known Member
Joined
Oct 14, 2011
Messages
209
Reaction score
17
Location
Egypt
i was following this tutorial and when i insert
  • nano /etc/nginx/sites-available/default
  • it doesnt work any help?
Hello people and welcome to another one of my very helpful and education tutorials. This time I bring you something that will help many many people out there, whether you want to set up your new dedicated server, want to learn how to set up a web server for whatever reason or want to learn a bit about compiling TFS 1.0 on Linux this is the place.

Now Sit back and PAY ATTENTION as we go through some interesting stuff here.


We need a few things before we can start, its best if you get them now before we proceed:
Debian 7 minimal with ssh(any type will do really, just make sure to apt-get install openssh-server to have openssh installed. Also if you already installed a LAMP stack or w/e it may cause trouble.)
PuTTY
Filezilla
Notepad++

Lets start by logging into our server:
B9VDzMX.png

Enter your credentials:
mpFbas5.png

(If you are not logging on as a root user you must add sudo infront of all the commands we execute, or use su and continue normally.)
Now start by doing:
Code:
apt-get update
apt-get upgrade
Now lets set up a LEMP stack with phpmyadmin:
First lets install MySQL:
Use:

Code:
apt-get install mysql-server php5-mysql
xFLtw4x.png

During the process you will get this:
00VmQjh.png

Enter a secure password, then confirm it in the next screen
After that wait a few seconds and it will be done

After that execute
Code:
mysql_install_db
Then we execute:
Code:
/usr/bin/mysql_secure_installation
And enter your root password


It will then ask you if you want to change the root password, change it to something secure:
then y, n, y, y

And now MySQL is set up
cmXy3fV.png

Now lets setup our web server(nginx):
Code:
apt-get install nginx

3TSKAFO.png

Now start nginx
Code:
service nginx start
Now if you go to your IP adress and everything was successful you will see this

HYJ6YBH.png

If you dont know your IP address you can use ifconfig to get it.
Now we must edit the config, this can be a bit tricky so be careful
Do:
Code:
nano /etc/nginx/sites-available/default
(or any other editor you like, this is nano)
Then carefully do the following edits:
8iEzjJx.png

Uncomment the following lines in yellow(remove the #)
KV7MG9f.png

Uncomment these lines as well and add the one with the red arrow
DjjIx35.png

Now save and exit

Now lets install PHP and configure it:
Code:
apt-get install php5-fpm
Now configure it
Code:
nano /etc/php5/fpm/php.ini
Find:
Code:
cgi.fix_pathinfo=1
and change it to =0
yJmgrVH.png

If its commented with a ";" just remove the ;

Now we edit another file:
Code:
nano /etc/php5/fpm/pool.d/www.conf
look for "listen = 127..." and change it to "listen = /var/run/php5-fpm.sock"
4eo6Fc4.png

Now save and exit.

And now restart php
Code:
service php5-fpm restart

Now we can test php to see if its configured by doing this:
Code:
nano /usr/share/nginx/www/info.php

Add the lines
Code:
<?php
phpinfo();
?>
Save and exit and restart nginx and test by doing:
Code:
service nginx restart
Then go to to see all the php info:
youripordomain.whatever/info.php

Now lets set up phpmyadmin
Get it by using

Code:
apt-get install phpmyadmin
You will be prompted to install for either lighthttpd or apache, just press tab then enter to configure for none. After that the install will ask you something about a database, press yes, then for some passwords, remember to set strong passwords.


Now we are going to link phpmyadmin to nginx
Code:
ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www
Then restart nginx by using
Code:
service nginx restart
Now lets enter phpmyadmin by going to youripordomain.whatever/phpmyadmin
enter a user and password. If you are unsure use root and the pass you set during installation.


Continued on next post...
 
Back
Top