Last week we spent 6 days setting up a LAMP server on Fedora. And yeah it only really takes one day out of your weekend to set it up. However we spent each day setting up each part of the server, to be as detailed as possible when doing this.
But now your probably axcious to remove the Apache Test page from the server and replace it with one of your own pages or maybe your own site.
This is very simple to do. And their are many ways it can be done. If you have physical access to your server. You could put your website onto some sort of storage medium. Such as a CD/DVD, Floppy Disk that is if your server has a CD/DVD drive or a Floppy drive. Heck you could even put your site on a USB drive and copy it over that way. Of course you need a USB port on your server to do just this.
Of course their is the possibility that you don’t have physical access to your server. If this is the case their are several methods of getting your site onto your server. I will however only mention 2 of them.
Use the FTP (File Transfer Protocal) to get the site on your server. I must state that even though FTP is still very widely used and has been for several years. I myself don’t recomend it. This is simply because FTP sends your information out un-encrypted. All it takes is to find out your information is packet sniffer on your connection using Port 21. However since it is in fact very widely used we will use this method.
First we need to make our server be able to act as an FTP server. To do this we will install an FTP Server software onto our server. Don’t worry this won’t mess up our current LAMP setup. Or if we have multiple P’s LAMPPP setup. Their are many FTP servers for Fedora. But we will use Pure-FTPd in this example.
To install Pure-FTPd we will issue the following commands.
yum install pure-ftpd -y
The above should install Pure-FTPd onto the server. Now we will need to configure it. To do this we will access the configuration files which are found in the /etc/pure-ftpd and the file name is pure-ftpd.conf. So we will edit it with our Nano text editor. To do this we will type the following.
Now we will most likely want to make it so anonymous people wont be able to access it. So we will disable this option. This option can be found near line 77 in the configuration file. So we will press CTRL + W. This will let us search. Since we know the Line number we will also press CTRL + T. Now we will enter the Line Number. So we will type 77 and hit Enter. This should bring use directly to point in the file that says the following.
We will change it to be like the following.
We will also want to change the UnixAuthentication. This can be found near line 143. So we will go to line 143 and we will see something that looks like the following.
And we will change it to look like the following.
We may also want to use TLS to login. So we will find TLS in our configuration file. It will look something like the following.
Notice that the # sign is next to the TLS. This means it is commented out. And disabled, We will remove the # sign and keep the number 1 their. So the line should look like the following.
Now we will exit and save our changes. To do this we will press CTRL + X. It will ask us if we want to make changes. We press the letter Y followed by press the Enter Key.
Now we will start Pure-FTPd, and Enable it. To do this we will type the following commands.
systemctl start pure-ftpd.service
The above starts the Pure-FTPd server. Now we will enable it. This can be done with the following commands.
systemctl enable pure-ftpd.service
One last thing we should do. Is check our server’s Firewall setting the FTP protocal uses Port 21. So we will want to see if Port 21 is being blocked by our Firewall. To do this will will access our Firewall by typing the following commands.
This will bring up the following screen.
Use the Tab key to navigate to the Customize button. Then press Enter. You will see a list of protocals. Use the arrow keys to navigate to the FTP (21) section. And then press the space bar to check it.
Then save the changes and exit out of the Firewall. Now you should be able to access the server via FTP from any computer inside of your network. If you want to access the FTP from outside of your network you will have to access your router and enable port 21 from your router.
To access the Server via FTP we can use any FTP client that ships with our prefered OS. But they usually are command line based. You may want to install 3rd party one like Filezilla. Once you have Filezilla installed on your computer. You will be able to access your server by telling Filezilla your servers IP address, the user name for your server, and your user names password.
Apache stores websites in the /var/www/html directory on your server. So we will navigate to that location. Once we are their we will be able to simply drag and drop our website files from our computer into that location on Filezilla.
Boom your done. Now you have different website other then the test website set up by Apache.
This method is the method I prefer. It is using SSH. Most Fedora installation have an SSH server already installed. So their isn’t much that you will need to do. However you may want to check your firewall settings. And if you want to access your server using SSH outside of your network you will also want to check to see if your router is blocking Port 22. If it is you should unblock it.
To access your server remotely using SSH. You can use Filezilla. Tell Filezilla to the IP Address of your server, your user name, your user name password, and change the option in Filezilla from FTP to SFTP. This should be it. And you can add your website the same way as before.