Recently I have taken it upon myself to teach myself something new.
There has always been a section of computing which has fascinated me, the domain of web servers. Luckily for me, Linux (xubuntu of the time of me starting.) is so easy to set up a web server.
I decided this was something I wanted to do when I stumbled across a tutorial on how to set the Apache client on a Raspberry PI. Again, luckily for me, the steps where easily transferable to my version of linux, (Raspberry PIs use their own version called Rasbian, which a ubuntu based distro.)
The commands on how to install apache2 on a Ubuntu system is as follows:
This will install the apache2 server on your device, by default, the directory of the html files is /var/www/. To test if it installed successfully, open your browser and type in: localhost
Now, you should see the stock Apache place holder html, in order to change the file and start building your site, you will need to gain permissions for the /var/www folder as well as the /etc/apache2 folder (you'll see why later.) From a fresh install, both these folders are either owned by root or by Apache, which means you are unable to make any kind of changes to the folders or their content.
To change the permissions, simply open the terminal and type in the following commands:
$ sudo chown -R <USERNAME>:<GROUP> /var/www
$ sudo chown -R <USERNAME>:<GROUP> /etc/apache2
*Replace <USERNAME> with your username, and <GROUP> with the group you want it to join, I personally would suggest adding it to your username group.
These commands change the owner of the directory to the user, and the group to what ever you want (Note that the group needs to be accessible to apache)
The -R function changes all files inside the directory as well, if you would prefer the files to be left unchanged and to choose which ones are changed, omit the function.
Like I said earlier, the defult directory for the html files is /var/www, if you want to change this like I did. Because Wheatley's hard drive is quite small, I wanted to change the directory to a 64GB SDcard I bought specifically, the you need to navigate
to: /etc/apache2/sites-enabled and open 000-defult in your favourite text editor.
Look for the bit where it states the document root is /var/www and change this to what ever, (for me, it was /media/SERVER) and restart apache2 with this command:
Or
There has always been a section of computing which has fascinated me, the domain of web servers. Luckily for me, Linux (xubuntu of the time of me starting.) is so easy to set up a web server.
I decided this was something I wanted to do when I stumbled across a tutorial on how to set the Apache client on a Raspberry PI. Again, luckily for me, the steps where easily transferable to my version of linux, (Raspberry PIs use their own version called Rasbian, which a ubuntu based distro.)
The commands on how to install apache2 on a Ubuntu system is as follows:
$ sudo apt-get install apache2
This will install the apache2 server on your device, by default, the directory of the html files is /var/www/. To test if it installed successfully, open your browser and type in: localhost
Now, you should see the stock Apache place holder html, in order to change the file and start building your site, you will need to gain permissions for the /var/www folder as well as the /etc/apache2 folder (you'll see why later.) From a fresh install, both these folders are either owned by root or by Apache, which means you are unable to make any kind of changes to the folders or their content.
To change the permissions, simply open the terminal and type in the following commands:
$ sudo chown -R <USERNAME>:<GROUP> /var/www
$ sudo chown -R <USERNAME>:<GROUP> /etc/apache2
*Replace <USERNAME> with your username, and <GROUP> with the group you want it to join, I personally would suggest adding it to your username group.
These commands change the owner of the directory to the user, and the group to what ever you want (Note that the group needs to be accessible to apache)
The -R function changes all files inside the directory as well, if you would prefer the files to be left unchanged and to choose which ones are changed, omit the function.
Like I said earlier, the defult directory for the html files is /var/www, if you want to change this like I did. Because Wheatley's hard drive is quite small, I wanted to change the directory to a 64GB SDcard I bought specifically, the you need to navigate
to: /etc/apache2/sites-enabled and open 000-defult in your favourite text editor.
Look for the bit where it states the document root is /var/www and change this to what ever, (for me, it was /media/SERVER) and restart apache2 with this command:
service apache2 restartOr
sudo restart apache2 After this, you may start working on your site, have fun!
0 comments:
Post a Comment