| site search by freefind |
Just for background - I am a computer officer at an UK University. I also do this as part of my non-working life, as I am a saddo.
February 2011:
Bear with me, this is a completely new Linux operating system that I have never used before. I am about to sign up for a dedicated server with a web hosting company; and need to understand centOS fairly quickly. It appears that it is very like Red Hat, and I have never used this OS before either! I run a host of historical pub sites, etc. in my spare time.
I am used to Ubuntu, and SuSE; so hopefully it is not too different.
1. Important, if you change a file, make a backup copy first - e.g. httpd.conf
2. Get stuck in.
3 How do you start and stop the server? apachectl stop / start / restart
4. Where are the relevant configuration files? I am looking for httpd.conf which appears to be at:
/etc/apache2/conf/httpd.conf
5. Check out the ip address of the server - ifconfig; and also make sure that ssh works. I am working on a local server which only responds to the ip address at present. The sever I will be building on I will have root access through ssh, but not much else.
6. Lets do some stuff via ssh - login as root, with relevant password.
7. cd /etc/httpd/conf and pwd to confirn the actual directory we are in.
8 In ssh you can use vi httpd.conf or at the machine you can probably use gedit httpd.conf (do not forget to backup this file first); e.g. cp httpd.conf httpd.conf-orig
9 Now. let's have a look at this file - more httpd.conf
User & Group are apache. I tend to prefer different user and group, e.g. nobody and nogroup. Leave it as it is at present.
ServerAdmin email address - change as you wish
ServerName - the # before it means it is commented out. I will leave this as is at present.
DocumentRoot "/var/www/html" - this is important, and can be changed to (say) /usr/local/Web
There is an entrey - <Directory "/var/www/html"> a few lines further on; if you change DocumentRoot, you also need to change this!!
10. Right, lets edit the httpd.conf file. This is at /etc/httpd/conf and I am in ssh mode, so I cannot use gedit, instead I am going to use the vi editor.
Quick command syntax for vi: i - insert, Esc - escape insert; quit is :q! without saving (that's colon then q then exclamation mark).; save is shift key and Z twice. A couple of delete commands - x removes a character; dd removes a line. These five commands do most of what you need to do. I never use much else.
11. vi httpd.conf
12. In the first instance I have changed the DocumentRoot & Directory settings to /usr/local/Web
13 apachectl restart
14 I get an immediate error - along the lines that the directory does not exist.
15 cd /usr/local and then mkdir Web and cd Web and vi index.html
In the index.html entry add a simple line - hello kevan
16 Now we need to check the config file by typing apachectl configtest and then restart apache - apachectl restart
next page of introduction to centOS apache configuration setup
| site search by freefind |