Hello There, Guest!
View New Posts  |  View Today's Posts
[TUT] Web Server on Linux Debian

  • 1 Vote(s) - 5 Average


04-15-2012, 09:27 AM #1
Lee Stevens
Senior Member
***
Posts: 345 Threads:54 Joined: Feb 2012 Reputation: 12

[TUT] Web Server on Linux Debian
Hello, Penguin Lovers!

Okay, this is my FIRST Linux Debain or any Linux Tutorial, this one is going to be about setting up a Computer/Server as a Web Host on Debian.

Okay first install Debian FREE :) from here. Once you have completed the installation and logged in we can get started.

1. Installing Apache + PHP
Apache is one of the most famous web server which runs on most Linux based servers. With just few commands you can configure Apache to run with PHP 4 or PHP 5.

For this example we are going to install PHP5, just run the following command on Root Terminal. (Applications > Accessories > Root Terminal).
Code:
apt-get install apache2 php5 libapache2-mod-php5

Apache configuration file is located at: /etc/apache2/apache2.conf and your web folder is /var/www.


To check whether php is installed and running properly, just create a test.php in your /var/www folder with:
PHP Code:
<?php
phpinfo 
();
?>

or

Code:
nano /var/www/test.php

Then input the same as above.

Point your browser to http://localhost/test.php or http://internal.ip/test.php and this should show all your PHP Configuration and default settings.

You can edit necessary values or setup virtual domains using apache configuration file.

2. Installing MySQL Database Server

Remember running MySQL Server to a fair extend requires at least 256MB of RAM. So unless you are running database driven sites you don't absolutely need MySQL.

The following commands will install MySQL 5 Server and MySQL 5 Client.
Code:
apt-get install mysql-server mysql-client php5-mysql

The configuration file of MySQL is located at: /etc/mysql/my.cnf

Creating users to use MySQL and Changing Root Password

By default MySQL creates user as root and runs with no passport. You might need to change the root password.
Code:
mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;

3. phpMyAdmin Installation

phpMyAdmin is a web based database management and administration software and easy to install and configure under Apache.
Code:
apt-get install phpmyadmin

The phpMyAdmin configuration file is located at: /etc/phpmyadmin folder.

To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf:
Code:
Include /etc/phpmyadmin/apache.conf

Now restart Apache:
Code:
/etc/init.d/apache2 restart

That's your Basic web server set up! Congratulations!

4. Add-ons
That's your Basic web server set up, but i added mod_rewrite to mine so i can use fancy URL's on my sites so i'll show that too:
Code:
a2enmod rewrite

Then edit /etc/apache2/sites-available/default

Find the following
Code:
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

and change it to
Code:
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all

and finally restart Apache
Code:
/etc/init.d/apache2 restart

:D

Hope it's okay. any question just ask!
This post was last modified: 04-15-2012, 09:36 AM by Lee Stevens.

05-02-2012, 08:02 PM #2
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

RE: [TUT] Web Server on Linux Debian
Can't believe I never saw this post. This is some great info. Thanks Lee!

05-03-2012, 04:25 PM #3
Lee Stevens
Senior Member
***
Posts: 345 Threads:54 Joined: Feb 2012 Reputation: 12

RE: [TUT] Web Server on Linux Debian
I did wonder when no one posted i was like oh erm, dam no one likes my post lol.

05-03-2012, 05:04 PM #4
Spirit
One with Spirits
****
Posts: 572 Threads:66 Joined: Jun 2011 Reputation: 13

RE: [TUT] Web Server on Linux Debian
I've seen it few times, always wasn't able to post or login, then I forgot....
KoBE did however and reminded me... :D

I personally just go wget (x/l)ampp and extract it, it's simple fast and has this little Python script as a Control Panel, besides that you can also easy set passwords for apache, mysql, etc..

The way you describe it is hard for people new to linux, but, it's the way they SHOULD learn it, simply because the more you use linux the more you find your self doing things in the Terminal, so well done tutorial...

Note by side, a link to doc's of "apt-get" would be good, for those who are really new to linux, though they shouldn't really be reading this :D

05-05-2012, 04:49 PM #5
Lee Stevens
Senior Member
***
Posts: 345 Threads:54 Joined: Feb 2012 Reputation: 12

RE: [TUT] Web Server on Linux Debian
I learnt this way when i only had root access to a Server. I mean yeah sure today's world you have GUI's for everything and packages for everything but i learn at the deep end lol.

And here's the Doc for apt-get: https://help.ubuntu.com/8.04/serverguide/apt-get.html

08-20-2012, 02:47 AM #6
DefAnli
Junior Member
**
Posts: 46 Threads:10 Joined: Aug 2012 Reputation: 0

RE: [TUT] Web Server on Linux Debian
Nice tutorial Lee, but i think if new users will use tasksel will be better for them, it is very basic and also simple GUI to install web server.

cheers,

DefAnli

11-22-2012, 12:56 AM #7
csin
Junior Member
**
Posts: 15 Threads:0 Joined: Nov 2012 Reputation: 0

RE: [TUT] Web Server on Linux Debian
Nice, but I suggest using nginx. It is more secure.




Forum Jump:


Possibly Related Threads...
Thread Author Replies Views Last Post
  Why Did I Ever Leave You? <3 | Linux Discussion BreShiE 6 6,461 09-29-2015, 11:42 PM
Last Post: KoBE
  Games on Linux Adriana 8 4,874 01-26-2014, 07:59 AM
Last Post: koko27519
  Resources to learn Linux commands Adriana 4 2,650 01-26-2014, 07:58 AM
Last Post: koko27519
  Linux and touch screens Adriana 4 3,626 08-22-2013, 04:18 AM
Last Post: Nuno Brito
  Favorite Linux distribution? Adriana 3 2,425 01-23-2013, 09:39 AM
Last Post: Nuno Brito


Users browsing this thread: 1 Guest(s)