Tuesday 12 June 2012

How to install and configure the Apache Web server on Windows

Method step by step installation and configuration of Apache so easy, just copying and pasting the basic parameters so that we can have entire websites in our PC and access them the same way as on the Internet. Method that allows those who do not possess advanced knowledge, to have your own web server on your local computer.
Installing and configuring the basic parameters and basic Apache server that allow its use and then add modules and other features according to the needs and purposes of those who are ready to use. 
How to access the server from other computers on a local network, how to connect to internet through Apache, save web pages in cache and finally serve your web pages on the Internet and allow access to the server from the outside.
What is a web server?
A web server as its name implies, is software installed on a computer with all the necessary conditions to serve or deliver web pages that are requested by a browser, ensuring that display and represent all the elements necessary for proper operation and display. 
There are several types of web servers, Apache is an open source software, free to use and fully configurable, is now the most used in the network, either Linux or Windows. When installed on our PC will have a complete server with all the requirements to run locally.
Advantages it brings to install the Apache server on your computer
With the installation of Apache is possible to have in our PC for a small server that will enable us among other things: 
1 - Try and see web pages as they truly are to be displayed from the internet before uploading to a host or server on the network. Useful and necessary if you have or you will create your site however modest it may be. 
2 - Create Virtual Host module by multiple websites on our PC, we can download with wget and access them like on the net but this time locally. 
3 - able to see locally made ​​web pages in PHP. 
4 - Serve our website pages or directly to the Internet, you can access and connect every person from outside, in this case obviously the server performance will be limited while we run the PC and the possibilities of our connection. It can be a very encouraging experience for any fan, this possibility has the advantage that it is not necessary to rely on any company or remote server to upload content to the network we want to show. It's like riding a small radio station and start broadcasting (similarity) but in this case the scope is global. 
5 - can act as an intermediary between our computer and internet which gives us several advantages in the field of security. 
6 - Through internet it can serve several computers connected in a local network. 
7 - It is possible to activate a module that allows to cache all pages loaded which will improve the performance of our navigation.
How to install Apache
Installation is simple, download Apache.org. the latest version for Windows, you can use the following link. http://httpd.apache.org/download.cgi apache22 #
Create two folders on drive C, the first and second name servidor_web Apache. Unzip the downloaded file and run it, follow the installation steps and data that ask you just pick the destination of the facility, which will be the folder you created in C: \ Apache, the other data leave them the default for configure later. 
the installed program creates an icon in the notification area that lets you: start, stop and restart Apache, you should keep in mind that any changes you make to the configuration file will not take effect until you restart the server.
How to configure the Apache
All configuration for running Apache is stored in a text file named: httpd.conf which is located in C: \ Apache \ conf, you can edit in any text editor such as Notepad but a recommended program is Notepad + +, free software that is unbeatable. 
can download Notepad + + from here. 
You have two options here: 
1 - First option, the simplest, download at the following link a copy of the httpd.conf file, unzip it, copy it or move it to the C: \ Apache \ conf and replaces the original file, and have ready to run the server. 
2 - The alternate advanced but not difficult, open the httpd.conf file and manually edit the lines indicated: 
All Lines beginning with # are comments in each section explains the various options but are in English.
Listen Line 52 indicates the IP address and port that the server will receive requests, you can use in the following ways: 
1 - The server will receive requests only from the same PC: Listen localhost: 80 
2 - receive requests other machines on a local network: Listen 80
In line 149 DocumentRoot to specify the path to the local folder containing the pages and files to serve, in your case will be the folder you created in C :/ servidor_web, would be as follows: 
DocumentRoot "C :/ servidor_web"
Line 177 sets <Directory> permission to the directory above, would be: 
<Directory "C:/servidor_web">
This is the essential configuration parameters to start using Apache. Saves changes and reboots the server by clicking the notification area icon.
Start using Apache
Copy the folder C :/ servidor_web any website or any files and access it by typing in the address bar of your browser 127.0.0.1 or localhost.If it is a website you're designing the show will see how Internet really. 
Any problems will be reflected in the server logs stored in C: \ Apache \ logs, you can open with notepad, in access.log file records all disclosures made ​​to the server, both your PC and Internet, in error.log records all operation errors, analyze them regularly will help a lot.
Access the Apache server from LAN
To access the server from another computer connected over a local network only need to type in the address bar the IP address of the computer that hosts, ie the one with the Apache server installed. 
To know the IP address need only open CMD window by typing Start> CMD, type in the window that opens IPCONFIG / ALL and press Enter, find the line Gateway, then the number is the IP address of the proxy. 
If the server listen on a different port to 80 (default) writes: "ip address: port", eg 192.168.1.3:8080 
In case of conflicts in trying to connect to a computer using a local network, check the following: 
• The IP address the computer you want to connect. 
• If Apache is listening on the port to which the request is made. 
• If the Windows firewall is blocking the connection. 
• If you receive an error message with code 403 means that there are no with the necessary permissions to access the directory, then establécelo as follows: <Directory "path to directorio"> Options Indexes FollowSymLinks AllowOverride None Order allow, deny Allow from all </ Directory> 





How to connect internet through Apache from your PC
For your internet connection goes through the server you configure it as a proxy for that fordward the configuration file httpd.conf uncomment (remove the #) the following lines: 
LoadModule proxy_module modules / mod_proxy.so 
modules LoadModule proxy_http_module / mod_proxy_http.so 
then adds at the end of file line: ProxyRequests On 
Close and save the changes. 
Access Internet Options via Control Panel, click the Connections tab LAN Settings button and check the box Use a proxy server, type in Address: 127.0.0.1 and Port: 80 or you will be using. OK in all windows. Restart the server. 
This applies if you use Internet Explorer and Google Chrome, if you use Firefox the above options you have to enter them in: 
Options> Settings> Set as Firefox connects to Internet. 
From now on all your connection goes by Apache, whether local or external address.
As cacheable Web server pages
To save to cache web pages web server do the following: 
Create a folder on drive C CacheRoot name, which will store the files in the cache, you can create on another drive, then you would have to indicate their path in the configuration file. 
In the httpd.conf file uncomment (remove the #) the line: 
LoadModule expires_module modules / mod_expires.so 
And add the following lines: 
LoadModule cache_module modules / mod_cache.so 
disk_cache_module LoadModule modules / mod_disk_cache . so 
copy and paste the following lines of code at the bottom:
<IfModule Mod_disk_cache.c> 
CacheRoot c :/ CacheRoot 
# CacheEnable disk / 
CacheDirLevels 5 
CacheDirLength 3 
86400 CacheDefaultExpire 
CacheIgnoreNoLastMod On 
CacheStoreNoStore On 
CacheStorePrivate On 
CacheEnable disk http:// *
</ IfModule>
<Directory "C:\cacheroot"> 
Options Indexes FollowSymLinks 
AllowOverride None 
Order allow, deny 
Allow from all 
</ Directory>
<IfModule Mod_expires.c> 
ExpiresActive on 
ExpiresDefault A604800 
</ IfModule>
The value specifies the time ExpiresDefault A604800 seconds persist in your cache, you can modify it according to your needs. All other values ​​you can adjust it at your convenience. 
Read the following pages in the manual folder: C :/ Apache / manual / mod / mod_disk_cache.html C :/ Apache / manual / mod / mod_expires.html

Restart the server.
Serve your pages on the Internet and allow access to the server from the outside
To serve your web pages on the internet you must first set the ServerName line 147, name server, you have the following options:
1 - You have a fixed internet connection, replace localhost with the IP address you assigned followed by a colon and the port to use, the default http protocol is 80. If you connect through a router would be the IP address of this because yours is a local address in this case. 
2 - You have an internet connection dynamics, the most common means that each time you connect your service provider Internet you are assigned a different IP address. In this case each time you need to install in your httpd.conf file enter the IP address assigned at the time, which is quite uncomfortable. 
3 - The other option is to access the DynDNS service offering that will synchronize the IP address you assigned to your server. Read more below an extract from Wikipedia.
Using DynDNS Service
DynDNS (Dynamic Network Services, Inc.) is a U.S. Internet solutions dedicated to DNS dynamic IP addresses. Offers free subdomains IP redirection to a long list of names available, giving individuals the opportunity to create a free web server with an address like 'wikipedia.dyndns.com', should be updated by a client on the machine the client, such as that the same company offers.
DynDNS can access the following link: DynDNS, you must register and then choose a domain name through which you can access your server from the internet, you have to download an update client https://www.dyndns.com/support / clients.html they give you (it's easy only weighs about 700 KB) and install it on your PC. In this case in your httpd.conf file do not have to change anything left intact with the value ServerName localhost: 80, from DynDNS will now synchronize your IP address.


If you configured the server name added to the end of your httpd.conf file the following line: 
Listen 80 to access through port 80 which is the default web browsing. 
There are ISPs that close this port, you can try if that If yours is accessing this page: https://www.dyndns.com/support/tools/openport.html entering your IP address and port, if so change testing another port, eg 8080 and specify it in the httpd.conf file like this: Listen 8080 is all, and if they work for outside access to your page, they should write to the browser: tudireccionIP: 8080 / If you installed the DynDNS update client would not necessarily be the IP address if the address assigned by the service.

0 comments:

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes