Step 1: Install Apache HTTP Server
First, you must disable and stop any firewall or server software running on your computer (including Windows Firewall, Skype, Trilian or other instant messaging applications). This is extremely important because otherwise it could also cause the installation and launch of the server that is faulty. These programs and services can be used normally again after the web server has been set up.
Download Apache HTTP Server here, click on the link at the " Win32 Binary (MSI Installer) " link, perform the installation according to the instructions, agree to the copyright agreement and use the default path for Apache files (in C: Program FilesApache Software FoundationApache2.2 ) When entering the server information window, enter your email address and domain information:
Complete installation operations with " Typical installation " setting.
Once completed, open the web browser window and enter the address http:/// localhost / . If the first visible page has the words' It works! 'means your installation was successful.
During the installation process if you encounter the following error " Only one usage of each socket address (protocol / network address / port) is normally permitted.: Make_sock: not able to bind to address 0.0.0.0:80 no listening sockets available, shutting Unable to open logs "means that some server programs (like Skype) have prevented the installation of Apache. To completely remove these programs, go to the command prompt and enter:
netstat -a -o
Find the PID (Process ID) of the program running on port 80 (or http). Then open Windows Task Manager (Ctrl + Alt + Del), select the Processes tab. Go to View and select Select Columns and check the PID box. Compare the PID of the command window and PID in Task Manager to see which program is running and turn it off. Then try reinstalling Apache.
Step 2: Configure Apache to share documents from the specified directory
Suppose you want to share your music collection so everyone can download it, and all your music files are in the C: UserMy Music folder . First open file C: Program FilesApache Software FoundationApache2.2confhttpd.conf using the Notepad program. This is Apache's configuration file and we just changed a bit of the content in that file.
In the httpd.conf file, add # notes outside the command line starting with DocumentRoot and create a line with your new directory, the result will look like this:
#DocumentRoot "C: / Program Files / Apache Group / Apache2 / htdocs"
DocumentRoot "C: / Gina / My Music"
Add # notes to the command line starting with
#
About 20 lines below the line
AllowOverride None
Change it to:
AllowOverride All
After editing, save the httpd.conf file. Then double-click the Apache icon in the Taskbar and select ' Restart '. If Apache restarts successfully, you have edited the file correctly. Try http:/// localhost / word in the browser, you will see a list of music files displayed here.
Step 3: Password for shared documents
The files are shared but you want only some people to be able to download your music files. Your bandwidth is extremely valuable so some things need to be secured. Please set a password.
First, open a command window (go to Start , select Run , enter cmd and press Enter). Go to Apache's bin directory by typing:
cd "C: Program FilesApache Software FoundationApache2.2bin"
Then create a password by typing:
htpasswd -c "C: Documents and SettingsUsermy_password_file.txt" User
Replace the above path with the path of your new password file (you can put the file in any directory EXCEPT the web server document - in this case, C: UserMy Music). Replace User with the username you want to use. When asked, enter the password you want to set up. After completing this step, the password has been created.
Then open Notepad to create the file with the following content:
AuthType Basic
AuthName "This is a private area, please log in"
AuthUserFile "c: Documents and SettingsUsermy_password_file.txt"
AuthGroupFile / dev / null
require valid-user
Make sure you replace " C: Documents and SettingsUsermy_password_file.txt " in the text with the password file you created above. Save this new file IN THE WEB SERVER DOCUMENT ROOT (in this case, C: UserMy Music) and its name is .htaccess . Don't forget the dot ( . ) Stands at the beginning of the name, so in this case, we'll save the file as C: UserMy Music .htaccess .
Note : If you use Notepad to create a .htaccess file, when you save the file, put double quotes around the file name - '.htaccess' - so that Notepad does not automatically add the .txt extension to the end of the name. file. If the file name has the .txt extension, your password will not work!
Now use the web browser, go to http:/// localhost / you will be asked to log in. Enter the username and password you set.
Step 4: Allow web server to work
If the server does not turn on the firewall, you can access your web server from any computer by entering the machine's IP address into the address bar of the web browser. If you do not know the IP of the server, go to this site to know the IP address. If the server IP address is 12.34.567.890 , enter http://12.34.567.890 in the address bar of the browser. If your computer has a firewall (like a wireless router firewall), you need to open port 80 on the firewall and forward it to the computer you use as the server. How to set up as follows:
1, Determine the server's internal IP address
All computers on the local network have an IP address, it has the form 192.168.0.XXX. To know this address, go to the server to get the address, open the command window, enter the ipconfig command:
C: User> ipconfig
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix. :
IP Address. . . . . . . . . . . . : 192.168.0.11
Subnet Mask. . . . . . . . . . . : 255.255.255.0
Default Gateway. . . . . . . . . : 192.168.0.1
In this case, you can see the server's internal IP address is 192.168.0.11.
2, Configure the router
Most routers have a web-based management interface and are located at http://192.168.0.1 (This address also changes depending on the type of router. Refer to the information. guide your router)
After entering the correct path, enter the password to access the router administration. There is a section called " Port forwarding ", where you will set the number of ports that Internet requests will go in and the local computer will respond to those requests. As the screen below is a setting for the Netgear router with the forward port 5900 for VNC server, corresponding to the computer with IP 192.168.0.11.
The following are common services and their default port numbers:
Service Web port number server80VNC (remote control) 5900Instiki wiki2500FTP21BitTorrent6881-6990