A project I have been working on is an offline webserver to host important websites that could be useful when the internet goes down and you need very important info that just can’t be found in books.
Step 1: Installing XAMPP
The first thing I did was setting up XAMPP on my local server so I can use Apache and FileZilla at once.
I downloaded XAMPP from the XAMPP website and installed every possible feature it comes with.
Step 2: Downloading the website you want to host offline
To do this, I used a program called WinHTTrack that is able to download a full website and even change the links.
So up on first boot of HTTrack, you are greeted with a welcome screen.
At the welcome screen, I pressed Next >.
The website I am going to host offline is ready.gov this website has loads of useful information.
Step 2a: Naming the project and assigning a cattegory
Of course I called the project ready.gov for easy finding.
I set the category to Informational.
Step 2b: Set the path
As I installed XAMPP directly in C:\, the drive path to the htdocs (apache) is C:\xampp\htdocs.
Step 2c: Setting the action and web address
I set the action to Download web site(s) as that is what we are trying to do.
I added http://www.ready.gov to the Web Addresses box.
Step 2d: Preferences and mirror options
Press Set options…
As ready.gov has a lot of large PDF files and versions with other languages I all excluded them from the download.
I did this in the Scan Rules tab, where I added the following to the input box.
-*.mov -*.mpg -*.mpeg -*.avi -*.asf -*.mp3 -*.mp2 -*.rm -*.wav -*.vob -*.qt -*.vid -*.ac3 -*.wma -*.wmv
-*.zip -*.tar -*.tgz -*.gz -*.rar -*.z -*.exe
-*.pdf -*.docx -*.doc -*.log -*.msg -*.odt -*.pages -*.rtf -*.tex -*.wpd -*.wps
In the Limits tab, I changed the Max transfer rate (B/s) to 100000 B/s.
I also changed the Max connections / seconds to 5.
In the Flow Control tab, I changed a couple of things:
Number of connections: 5
Checked the Persistent connections checkbox.
I set the retries to 1.
I set the Min transfer rate (B/s) to 1000 B/s
In the links tab I checked Attempt to detected all links and Get non-HTML files related to a link.
I set the Local Structure Type to Site-structure, without www.domain.xxx/
I unchecked all the other options.
In the Spider tab I unchecked Accept cookies.
Log, Index, Cache
I unchecked Store ALL files in cache and Do not re-download locally erased files.
I checked Create Log files and Make an index.
I changed the Browser “Identity” to Mozilla/4.5 [en] (X11; l; Linux 2.0.34 i686) so ready.gov doesn’t immediately know I am copying their website.
I set the HTML footer to (none) and the language to en, *.
Then I pressed OK.
Then I pressed Next >.
I changed the dropdown box to Do nut use remote access connection and unchecked both checkboxes below it.
Then I pressed Finish and it started downloading!
Step 3: Start apache
In the XAMPP control panel, start Apache by pressing the first start button.
Now, the website will be able to be accessed locally using the computer’s IP address.
Step 4: Enable Virtual hosts
In the XAMPP control panel, press the Apache config button and press Apache (httpd.conf)
This file will now open in an editor.
At the # Virtual hosts mark, remove the # before the Include conf/extra/httpd-vhosts.conf.
Save the file and exit the editor.
Step 5: Add the Virtual Host
Open the XAMPP Control Panel and press the Apache Config button, press <Browse> [Apache].
Open the folder called conf, then open the folder called extra.
Now open the file called httpd-vhosts.conf in an editor.
In the file, add # in front off all Virtual Hosts that are currently in there.
In the bottom, add this:
ServerName the url to the website
ServerAlias the url to the website
DocumentRoot the file path to the website
In my case it is:
Save the file and close the editor.
Step 6: Adding your PC to the hosts file
To be able to navigate to the website in the browser, you must add the url to the Windows host file.
Navigate to: C:\Windows\System32\drivers\etc
Open hosts in Notepad++.
Add this to the bottom: 127.0.0.1 www.ready.gov
If you want the url to work on other computers, follow Step 7.
Step 7: Making the site accessible from other computers
- Open CMD on the host computer.
- Type ipconfig
- Look for the currently used internet adapter. For me it is Ethernet adapter Ethernet
- Look for the IPv4 Address, for me it is 192.168.1.176
- Now add this to the hosts file on the other computer: <IPv4 address you got from CMD> www.ready.gov
Now that computer will be able to access it as well!
This is the end! If you have any questions, email me at firstname.lastname@example.org!