Menu
Is free
registration
home  /  Multimedia/ Access to denver from the local network or the Internet. Denwer - your local web server: installing and configuring Denwer How to configure denwer on a local network

Access to Denver from a local network or the Internet. Denwer - your local web server: installing and configuring Denwer How to configure denwer on a local network

Web programming nowadays is available not only to narrow specialists in their professional activities. This area of ​​the IT industry is often faced and system administrators, and even ordinary computer users interested in the development of Internet technologies.
The article Bug # 1273 - Unknown collation: utf8mb4. Updating MySQL in Denwer we talked about transferring a site database from one hosting to another, as well as transferring a site to a local computer. Today we will talk about how to open a website deployed on a computer from another computer and from phones in local network .

Accessing Denwer from the local network

Before all the settings, here are some examples when access to the site from the local network might be really useful:

  • the site was created for corporate purposes ... That is, the site serves exclusively for work inside the office or building of an organization / institution. In this case, it is not always rational to spend money, albeit not the biggest ones, on buying a domain name and hosting;
  • required debugging the site in different versions operating systems , either different versions Windows, MacOS, Linux or other more exotic OS. Yes, to test the site on other operating systems, you just need to use virtual machine, but this is in the event that the site has already been uploaded to the hosting, but at the stage of preparation and making significant changes to the structure and design of the resource, the method with access to the site on the local network is very useful;
  • debugging the site on mobile devices Oh ... Some modern CMS templates can behave quite unpredictably when opened with mobile devices... Today, this should not be neglected, since search engines more and more loyal to the resources optimized for smartphones. Of course, popular browsers have an option to mimic the page display on mobile device, but if you check, then make sure that the operation of some of the site menus and the display of some elements in a desktop browser will still differ from those on a real mobile gadget.

These are just some of the reasons for organizing access to the site in Denver from the local network... You, of course, may have your own prerequisites for this. Next, let's start setting up.

The first two stages of preparation are carried out directly on the computer where the site is located, that is, where Denver is installed. This is our local server or, in other words, hosting, that is, the storage where all the resource files are located.

First you need to provide local server availability on the network. Modern versions Denver themselves write exceptions to the standard firewall operating system during installation.

But in the case when the main computer is unavailable from the local network, you need to add inbound / outbound connections to the Firewall exceptions.
First, add the access port to the exceptions of the Firewall or Firewall you are using. Default Denver uses port 80 .

If, after the settings made, the computer is still not accessible from external devices, then you need to add ip-addresses external computers and mobile devices on the local network to firewall exceptions.
You can read in detail how to find out the ip-address of a computer on a local network in the article Determining the ip address and mac address of a computer on the network... That's all we need to do on this stage.

Opening a site from Denwer by an ip-address in the local network

The second stage of the setup. Now we need to make sure that when connected to ip address our main computer the desired local site was opened... All the manipulations below assume that we already have denwer installed, and the local site is accessible from the main computer.

There are two ways open the desired site by the ip-address of the computer .

The first way- this is to create a directory in the Denver home folder, the name of which is the ip-address of the main computer, for example, 192.168.0.21 and already in this directory place the www folder with the site files. That is, the path to the directory containing the site will be as follows:

X: \ home \ 192.168.0.21 \ www \

where X is a letter virtual disk created when installing Denwer;
192.168.0.21

This method is simple, but its disadvantage is that it works at the stage of creating a local site... If you already have one, then this option is not suitable.
In addition, with such a setup, you will have to open the site exclusively by ip-address rather than domain name.

The second way to open a site by ip-address in the local network - file usage .htaccess

.htaccess(from English hypertext access) - an additional configuration file for a web server (such as Apache and the like)

A similar file may already be located in the www or public_html folder, but we need to create this file on the same level with these folders (www or public_html), that is, in the directory with the name of the site's domain name. .htaccess will be as follows:

X: \ home \ site \ .htaccess

The content of the file will be as follows (you can use other settings, but their discussion is beyond the scope of this publication):

# dnwr_ip 192.168.0.21

where 192.168.0.21 - ip-address in the local network of the computer on which Denwer is installed.
If for some reason you cannot create such a file, you can download the .htaccess file from the archive attached to the article: .htaccess

IMPORTANT! Before using the file taken from the above archive, you must open this file with any text editor (Notepad, Notepad ++ and so on) and in the line # dnwr_ip 192.168.0.21 change the value of the ip-address to the address of your computer with Denwer installed on the local network. After that, save the changes made to the file

After restarting Denver, when you switch to the ip of the main computer in the browser, the site will open in the directory of which the file is located .htaccess

Opening a site from Denwer on a local network by domain

The main goal has been achieved, our the site is available on the local network, however, fill in each time address bar the ip address is not very convenient. You need to make sure that the site on the local network opens when you go to the domain name in the address bar of the browser.

All we need to do for this is to edit the file properly. hosts in the client operating system.

IMPORTANT! File hosts on the main computer, you do not need to edit, all the necessary entries are entered into it when you start the Denwer program. All work at this stage is carried out exclusively with the file hosts the computer from which the connection to the site from the local network will be made

So, if the client computer has an operating Windows system , then we need to open for editing in any text editor(Notepad, Notepad ++ and so on) the file located along the path

C: \ Windows \ System32 \ drivers \ etc \ hosts

In the editor that opens, add a new line and add the following entries there:

192.168.0..168.0.21 www.site

where 192.168.0.21 - ip-address in the local network of the computer on which Denwer is installed;
site- the address, upon going to which the user in the local network should receive our site.

We save the changes.

if you unable to save the changes made to the hosts file, then you can copy the file to any custom folder(Desktop, My Documents, etc.), edit the file, save the changes, and only then place the file hosts back to the etc directory where the file was copied from.

If access in the local network is necessary to provide a smartphone / tablet based on Android , then a similar entry given above must be added to the hosts file, which is located in the following path:

/ system / etc / hosts

How to do this is described in detail in the article. We remove ads on Android. Hosts file
If with a text editor change the hosts file on Android failed, then you can use special utility, which is called Hosts Editor, and is designed specifically for this purpose.

IMPORTANT! And in case of editing hosts file on Android manually, and in the case of using Hosts Editor to successfully complete the operation, you need root rights (superuser rights obtained after hacking the operating system of the device). The same applies to devices iPhone with established iOS, on which for editing hosts the file is obligatory Jailbreak

File location paths hosts for some other operating systems (taken from the above post):

V UNIX-like operating systems like Linux the file is located in the directory:

V latest versions Mac OS X and iOS from Apple, the path would be as follows:

/ private / etc /

or simply:

What you need to know when working with Denwer on a local network

Settings made, our the site is available on the local network by domain name... Let's consider some points that need to be considered when working with Denver on a local network:

That's all, we have considered how to open a site from Denver on a computer and on a smartphone in a local network .


Is it possible to configure the system so that sites located on local computer, were available to all users of the local network to which I am connected, or even from the Internet? ..

Default Denver Projects not available from the local network. This is achieved by ensuring that all virtual hosts have an IP address of 127.0.0.1, always denoting the "current local machine".

Nevertheless, it is still possible to assign a particular virtual host an "external" IP address, accessible from your local network or even the Internet (if the computer has a permanent IP address on the Internet).

Remember: Denver is a developer tool, not a hosting tool. Although projects in Denver can be made public, we strongly discourage doing so. The point here is security: Denver, as a rule, is launched with Administrator rights, which means that scripts running under its control can do whatever they want on the machine. The slightest "hole" in the security of the script will give a hacker access to your machine.

Finding your IP address

First, you need to find out which IP address is assigned to you on the local network or the Internet. The easiest way to do this is to open Command line Windows and typing there:

ipconfig

You will see something like the following:

Configuring IP for Windows
WiFi - Ethernet adapter:
DNS suffix for this connection. ... :
IP address. ... ... ... ... ... ... ... ... ... ... ... : 192.168.0.49
Subnet mask. ... ... ... ... ... ... ... ... ... : 255.255.255.0
Main gate. ... ... ... ... ... ... ... ... ... : 192.168.0.1

In this case, the external IP address of the machine on the local network is 192.168.0.49. The list may contain several network interfaces at once (if your computer is equipped with several network cards or wireless devices). In this case, you need to determine which of the interfaces is external, accessible from the local network. (IP addresses starting with 192.168 or 10 are only reserved for access from the local network, not the Internet. That is, they are "private".)

Make sure your IP address is static i.e. does not change the next time the machine is turned on or rebooted. If the IP address is given dynamically, then it does not exist easy way allowing Denver to be connected to it.

Configuring a firewall (firewall, firewall) Windows

In most Windows systems, a built-in (or manually installed) firewall or antivirus blocks connections from external machines to the current one. This is for security reasons. Of course, if you open the site to the outside, this blocking should be disabled, otherwise no one will see the site.

Our goal is to resolve Windows connections to port 80 (HTTP protocol) of your IP address 192.168.0.49, on which Apache will "hang". Here are the instructions on how to do this in Windows XP:


  1. Open up Start - Control Panel, select Windows firewall.

  2. Go to the tab Exceptions.

  3. Click the button Add port, in field Name enter your IP address, and in the field Port number specify 80.

If you've installed your own firewall or antivirus software, then of course you'll have to consult their documentation.

An easy way to open the site outward

Let's say your IP address is 192.168.0.49 like in the example above. The easiest way to get Denver to open a specific site at http://192.168.0.49 is to put the site's documents in the directory:

/home/192.168.0.49/www

Yes, the directory name contains periods! Don't forget to restart Denver as well.

Moreover: if your ISP gave you not only the IP address, but also the one associated with it Domain name, then the site will be immediately available for this domain name. In the case of a static IP-address, the domain is given out almost always, you just need to get it from the provider. For example, if your domain name is equal to abcd.ints.ru (provider Korvet-Telecom NEKST), then the site will be available at http://abcd.ints.ru.

Another way to assign an IP address to a site

If you already have virtual host in Denver and you don't want to rename its document directory, then you can assign your own IP address to the site and make it accessible from the outside. Let's assume your host is stored in the / home / mysupersite / www directory. To assign it an IP address 192.168.0.49, you need to create a file /home/mysupersite/.htaccess and add the following lines to it:


## File /home/mysupersite/.htaccess
## Please enter your external IP here, not 192.168.0.49!
# dnwr_ip 192.168.0.49

By the way, you can find out what other directives there are by looking in the /home/custom/.htaccess file.


Restart Denver. Check that your site / home / mysupersite / www opens at http://192.168.0.49 (instead of 192.168.0.49, of course, you need to substitute your own IP address).

Security alert

To recap, Denver is not a complete and reliable Web server, it is just tool, allowing you to debug (test) sites without leaving your home. Any attempt to use it for other purposes may be unsafe.

In general, you can customize anything you want, it's another matter - necessary is it. Remember that a Web server that is open to the outside world represents potential vulnerability to protect your car. For example, an attacker can penetrate an incompletely debugged script. Because Denver is launched with Administrator rights (that is, with maximum rights in the system), then any script, even the smallest, can do whatever it wants. Let's assume you've written a seemingly harmless test.pl script that does the following:

#! / usr / bin / perl -w
use CGI :: WebIn;
use CGI :: WebOut;
Header ("Content-type: text / plain");
open (F, $ IN) or die "Could not open \ n";
while ( ) (print)

The program seemingly just prints the contents of the file specified in the fname parameter. For example, http: //localhost/cgi/test.pl? Fname = test.pl will print source programs. However, as you can see, calling open like this is unsafe. For example, by going to the address /cgi/test.pl?fname=|dеl+/s/q+c:\windows, the program will execute:

Open (F, "| dеl / s / q c: \\ windows") or ...

This will immediately destroy the entire Windows directory!

You might say that localhost is localhost so that it can only work from the current machine. If you opened access to the outside according to the instructions above, then everything is exactly like that. However, in the case wrong setting Apache can be penetrated to localhost and from outside (if the server is open). This is done very simply:

C: /> telnet server.ru 80
GET /cgi/test.pl?fname=|dеl+/s/q+c:\windows HTTP / 1.1
Host: localhost
here you just need to press Enter

Output: unless you have significant experience in server administration, installing an externally accessible Web server can be dangerous. This especially applies to the happy owners of dedicated Internet channels. One wrong move and one morning you wake up with a freshly formatted hard drive (at best).

The Denwer local server is extremely popular, so users have a lot of questions about its installation and configuration. This article, among other things, discusses and possible problems when working with denver.

Any modern site goes through a rather long stage of development, including both the creation and finishing of the template, and filling it with content.

This whole process, of course, should be hidden from future site visitors, so this work is carried out not on a remote, but on a local server, which is the developer's own computer with special software installed on it. Most often, such software is Denwer.

Strictly speaking, a local server is necessary for the development of serious projects - dynamic sites that require using php or Perl scripts.

Simple one page sites that run only in HTML and CSS can be successfully created and tested right in the browser.

Why is Denwer used more often?

As we have already found out, the local server is a specialized software, having installed which on his computer, the webmaster can develop his site without going out to the Internet.

There are quite a lot of similar platforms for developing sites today, among them the Denwer local server is popular. Therefore, users often have questions about how to start Denver.

This package of tools for web developers is versatile and customizable. It includes the Apache HTTP server, PHP preprocessor, PHPMyAdmin database management component, Perl interpreter and many more important and useful components.

The undoubted advantages of Denwer include the extreme ease and speed of installation of the package, as well as the fact that all Denver files after installation are located in a single Webservers folder.

On the question of how to update Denver, it should be said that the installer does not go into the operating system registry, so you can transfer all your local projects along with databases to another computer or disk. simple copying local server folders.

Denver is just as easy to remove - no traces remain in the system after deleting its folder, after which you can download the updated installation package from the official website and re-install.

The main drawback of Denver is the ability to install exclusively on the Windows operating system.

So, once again, let's briefly note the key features of the local Denwer server:

  • the basic version of Denwer can be easily extended with new distributions and modules;
  • databases are managed using the fully functional PHPMyAdmin panel;
  • there is a possibility of simultaneous work with any number of sites;
  • it is possible to install old versions of PHP4, MySQL4, which can be useful for developers if the site does not work with the current version of localhost denwer;
  • the functionality of the site on the local server is completely similar to the functionality on the remote server of any hosting provider. This allows you to fully test the site before uploading it to a remote server.

Step-by-step instructions for installing denver

For those who do not know how to use Denver, we note that the latter has the advantage of being extremely easy to install.

To install this tool developer, you need to do the following:

Don't know how to get your website up and running in Denver? Just create a project in the C: WebServershomelocalhostwww folder.

The next step is to set up a local server

One of the advantages of Denver is its ease of setup. How to set up Denver correctly, we will explain below. If you use the default settings, problems may arise when installing large extensions, or when importing a large database.

The default settings limit the size of uploaded files to just two megabytes. To remove this restriction, you need to edit the php.ini file (located in the usrlocalphp5 folder) in a regular text editor.

In the line upload_max_filesize = 2M, you should change the parameter 2 to 32, thereby limiting the size of the uploaded file to 32 megabytes.

In this case, in the line post_max_size = 8M, the eight should be replaced with the number 64, since this parameter determines the maximum amount of transmitted data, and it must be two, or even three times more than the limit on the size of the uploaded file.

If all users followed these recommendations, then there would be less talk about Denver not working.

Getting started with a local server

In order to start working with a local server, you need to start Denver by clicking double click on the "Start Denwer" icon on the desktop, open a browser and type the address http: // localhost / denwer / in the address bar.

If a window opens, the same as in the picture below, then your local server has started successfully. If error messages appear, it means that Denver does not start:

On the previously opened page http: // localhost / denwer / find the section “ Denver Testing"And in the table of this section, follow all the links available, each of which activates one of the installed modules.

If there are no problems, the capabilities of the future site on your local server will fully correspond to what you get on the remote server of the hosting provider:

First of all, check the PHP functionality and go to the database administration service - PHPMyAdmin.

If you don't know how to enter phpmyadmin denwer, just click on the corresponding link in the same table:

To start developing new project on your local server, you just need to create new folder, for example, Moy_Sayt.ru in the C: WebServershomelocalhostwww directory. Its name will match the name of your site.

In the future, in order to open a local site, in the browser it will be necessary to register the name of this folder after http: // localhost /, for example, http: //localhost/Moy_Sayt.ru/.

What if Denver didn't work?

After connecting the local server, the browser in some cases displays a message that Denver does not start. The main reason is most often because your antivirus suite or firewall is blocking it.

In this case, you will have to independently allow outgoing connection for the server via TCP on ports 80 and 443 for http and https, respectively. (It is usually located at C: webserversUSRlocalapacheBINhttpd.exe).

By the way, the popular Skype application can also occupy the same ports, so it is better to disable it while working with the local server.

Projects similar to Denwer

Although Denver is one of the most popular, flexible and simple tools for web developers, it is sometimes useful to familiarize yourself with similar solutions, which also provide the user with a full-fledged local server for website development.

So, for example, the denwer analogue XAMPP offers not only a set of tools for a local server, but also a complete graphical shell which, as noted earlier, is not available in Denwer. Therefore, many developers prefer XAMPP.

It is a software shell, which includes the appropriate distributions and modules that allow you to develop, test and debug sites directly on your local computer, without the need for Internet access.

Denver is traditionally considered one of the most relevant and effective instruments for web developers. Powerful configuration and debugging tools, the ability to comfortably develop and test sites on a local server create ideal conditions for working without risks for your site in the vastness of the network.

Working with Denver - features of the server itself

Before setting up Denver, you need to consider a few nuances of the server itself. First of all, key feature Denver becomes support for working with several web projects at the same time, with the location of each of them separately on its own virtual host. For this, a separate folder is created by the server for each project. Such hosts are created automatically.

As practice shows, setting up Denwer is not particularly difficult, but it is still important to take into account a number of key parameters for efficient and stable operation. First of all, how to work with Denver, what do you need to consider for customization?

All components of this software solution already provided fully configured, ready to go. Including SSL, MySQL encoding and others software... If desired, the user can independently manually update any of the services that are part of Denver. For this purpose, new versions of distributions are simply copied over the new ones in the folder.

After our installation is complete, the browser window will reappear, informing about the completion of the installation. You can safely close it. To start the program, we find the Start Denwer shortcut on the desktop - double-clicking on it, we will start our server.

Of course, the program needs some time to run. And after loading the application, two icons will be visible on the panel - if they are available, the launch went fine. When we open My Computer, we will see the virtual disk Z appear on the computer.

Moving on to it, we can notice several folders. In this case, we are interested in just the Home folder.

And here we will already notice the presence of several folders - Localhost and test1.ru, which will be root for two local sites. The first contains a set of utilities for working with the database, the second folder contains a test site with one web page.

Let's focus on working with the database. Here, to work with Denver, launch any browser by typing localhost or http: // localhost. After that, we will see a message about the server's operation.

Then, to configure Denver, scroll down this page to the Utilities heading and you'll see a lot of links. We select the line "phpMyAdmin - administration of the MySQL DBMS", after which we will see a new window.

We enter the name of our database in the Create new database field in Latin letters, it remains only to click Create and a new window should appear.

There is no need to do anything here, just click the Privileges tab to move on.

When we click Add a new User, we will see a new window in which a number of information must be specified:

  1. User name - mark the username.
  2. Host - here we specify Localhost, or you can select Local from the drop-down list.
  3. Password and Re-type - a password is required here. Or it can be generated using Generate. However, it is imperative to remember, it is better to fix it somewhere, we will definitely need it in the future.

Below we will notice the Global privileges block. Here you need to select all the options using the Check All button. Then it just remains to click Go in the right corner, after which we are done. It remains only to congratulate - when passing all these steps you have successfully finished creating your new database. Next, let's move on to its direct use for the effective and stable operation of our site.

How to work with Denver - go to CMS installation

We already have a fairly serious piece of work behind us, because we managed not only to install and configure the server, but even to create our own database. Now all that remains is to understand how to use the resulting resources to develop and test the desired site.

To do this, we have to install a specific CMS of our choice, which will be used for the site to work. But when installing the CMS, we will definitely need certain information, so we will immediately mark them somewhere on a piece of paper or in a file - including the name of the database, directly the name of the database user and his password.

For CMS installations there are no special difficulties on the local server, you just need to perform the following procedure:

  • Creation of a key folder in which our site will be located.
  • The necessary folders and files are transferred to this new directory.
  • We reboot our Denver server.
  • And all that remains is to install the CMS.

As an example, let's take a look at working with the now popular CMS WordPress engine. Other CMS, of course, may suggest certain nuances, but general principle almost always absolutely universal.


Thus, we learned how to install, configure and work with Denwer.

The modern capabilities of Denver ideally recommended it for stable operation, with the correct development and testing of the site without the need to place it on the network.

In our article, we covered the main steps on how to install and work with Denwer. To start most projects, this information is enough - we went through the stages of installation, starting the server, configuring it, creating a database and launching a full-fledged website. That is, we examined the entire life cycle to start developing a site - the rest depends only on your patience and talents, we wish you successful development and testing of high-quality and popular Internet resources.

Denwer is a fairly popular tool among web developers that allows you to deploy an environment on a computer for developing and debugging a site with the least amount of time. If you have used this tool, then you probably already noticed that it includes traditional software tools for web servers, including Apache, MySQL, PHP. In the overwhelming majority of cases, this is quite enough, in this article we will consider the possibility of using Denwer in a local network. Where might you need it? Well, for example, you work in an office, you need to open local network access for other computers for some time so that they, in turn, can open a website hosted on your computer.

Let's assume you have a directory where your site is hosted. Now you need to configure the Apache web server so that it can handle requests from the outside. Opening the configuration file:

C: /WebServers/usr/local/apache/conf/httpd.conf

We will take the default path, it is set when installing the Denwer package, if your server is located in a different path, change it for your case. Let's uncomment the line with the entry:

Listen 80

This tells the server to listen on port 80 on the computer.
Next, you need to register virtual hosts for your site, for this we open the file:

C: /WebServers/usr/local/apache/conf/vhosts.conf

We register our virtual host:

DocumentRoot Z: /home/localhost/www/host.example.com ServerName host.example.com

Where 192.168.0.132 is the IP address of your computer in the local network, DocumentRoot is the path to the directory of your site, ServerName is the domain that will be accessed from the local network. Do not forget to restart the web server after making changes to the configuration files.

Thus, in order to open the site from the side of client machines, they need to write in the file:

C: \ Windows \ System32 \ drivers \ etc \ hosts

The record looks like this:
192.168.0.132 host.example.com
Save the file, and then try opening host.example.com in a browser.
Now for those who have gone wrong. It often happens that it is impossible to open a site from the outside, the first thing I recommend is to look at the firewall as well as the antivirus installed on the computer with Denwer, they can often block traffic from the local network. I also recommend checking the availability of port 80 of the server from the client machine; for this purpose, you can use the telnet utility. We open command line in the system, enter the request:

Telnet ip-computer-with-site 80

If everything is in order, then a connection to the server on port 80 should go through, otherwise you will receive an error message.