Useful Tips

How to set up a web server on a Windows computer

Pin
Send
Share
Send
Send


A web server is a program that runs on a local or remote machine, and its main purpose is to allow the user to view web documents. When the site address is entered in the address bar, when you press Enter, the browser generates a request sent to the remote computer - the web server.

Apache HTTP server (short for English a patchy server) is one of the most popular and widespread programs created for web developers and administrators of Internet resources. According to independent researchers, Apache is installed on 50% of the computers of all users of HTTP servers.

The main advantages of Apache are stability, speed and flexibility, and they are due to the modular organization, as well as the fact that the development is conducted by an open group of programmers, albeit under the official name Apache Software Foundation.

Apache supports a huge number of operating systems and hardware platforms, and quite often it is used under the Windows operating system. It is also important that this web server is distributed free of charge.

How to install the Apache server for the Windows 7 operating system will be discussed in this article.

Apache installation

First of all, you need to download the latest version of the Apache distribution without SSL support and start the installation. In the welcome window, click on “Next”, read the developer’s license agreement and confirm your agreement with him.

If everything went well, the Apache web server control icon should appear in the tray. You can stop and restart it by clicking on the icon with the left mouse button.

Basic web server setup

Although Apache is very convenient and extremely reliable, not everyone is ready to use it as a local server for a number of reasons, and the main one is the lack of any graphical configurator even in Microsoft Windows, which is quite unusual for most users.

Server configuration is performed by manually editing the configuration file httpd.conf. However, contrary to the idea of ​​the incomprehensibility and complexity of this process, there is nothing complicated in this operation for two reasons: firstly, in order to make an Apache server that is configured for acceptable and comfortable operation, you need to change the configuration file quite a bit of data, and secondly, the httpd.conf comments contain a lot of useful information necessary to understand the configuration.

  • Run Apache under the Windows 7 platform,
  • Store in a user-friendly directory the files of the future site (for example, C: www),
  • Do not experience problems with the encoding, and in particular with the display of the Cyrillic alphabet,
  • The ability to work with multiple sites at the same time.

To successfully solve these problems, go to the folder with Apache installed, find and open the httpd.conf file in the conf subfolder. Please note that the lines beginning with a “pound” are text comments, and the settings for the web server use lines with no pound sign at the beginning.

First you need to configure the directory that will be used by the server as a website folder. Locate the line that begins with DocumentRoot in the text. This directive determines which folder will be the root.

Correct it on DocumentRoot “C: / www”. It should be clarified that the slashes in this file should be tilted to the right, and not to the left, as Windows users are probably used to. After the above manipulations, the problem with the location of your site has been resolved.

Next, you need to set security rules for the directory. Apache uses the Directory directive for this purpose:

What is “WAMP”?

Decrypted Wamp as Windows, Apache, MySQL and Php - these are the components that make up the package, together representing a complete web server. By installing it, in one fell swoop you will install all the necessary programs to run a full-fledged website, as well as a convenient interface from which it is convenient to administer all these components.

  • Windows in this case means that the package is designed for the Windows platform (There is also an assembly for Linux).
  • Apache - This is a program that actually is a web server that responds to requests sent by your browser. In principle, if only this component is installed, the web server will already be able to work, but it will only display static content. To display dynamic content, you must install the following two components: PHP and MySQL.
  • Php - This is the most common programming language for building sites with dynamic content. Most common content management systems, such as Drupal, Joomla, Wordpress use this particular programming language. If you plan to host something more than a set of html files on your site, PHP is an addition to the web server that will solve this problem.
  • MySQL - This is a database management system that is most common when building dynamic Internet sites that use databases to store almost all information: such as user names, passwords, article texts, and much more.

If you have Linux installed, then in order to install these same components, it is enough to execute one command (note the "^" symbol at the end):

For Windows users, there is an alternative - to install and configure Microsoft IIS, a web server from Microsoft, but we will not consider the issue of its configuration, since for a novice user to install all the necessary components will be a difficult task.

Before we start installing the server, you mean that using a home computer for this purpose, which is used to solve everyday tasks, as well as the Internet connection provided by ordinary Internet providers, will only go for testing or posting temporary web content, since the power of a computer and internet connection is hardly enough to serve a large number of visitors. In addition, it should be borne in mind that whenever you turn off your computer, the Internet site running on it ceases to be available to your visitors.

Install WAMP

To install WAMP, prepared a lot of packages, we will look at WampServer in this article. Follow the link and download the latest package for your platform, and when the download is complete, run it to start the installation.

The installation process is quite simple - just leave all the options in the default value and click Next.

In order to set the default browser, the installation wizard will ask you to select it by opening the file selection dialog box. It is not convenient, of course, that the program does not use the default browser installed in the system, but maybe the developers had their own reasons.

Make sure Apache is added to the Windows Firewall exception list:

After the installation is completed, before clicking the Finish button, set the “Start WampServer 2 now” checkbox.

After starting WampServer, the WampServer icon should appear in the lower right corner of the system tray.

By right-clicking on the icon and selecting localhost, your site will open containing the default page, which shows us standard information by which you can judge that everything works as it should. If you see a web page as shown in the figure above, your server is installed successfully.

Installation of additional components

Please note that for successful installation of WampServer, you need to install additional Windows components. This will be reported to you by a pop-up dialog box on the site when you try to download the installation package.

If you don’t do as instructed, when you install the program you will see an error of the following form:

WAMP setup

To quickly get to the directory where your files are located, right-click on the WampServer icon and select "Go to WWW folder."

The opened folder is the place relative to which the web server is looking for the requested files. It should contain files that can be operated by a web server, for example, it can be Joomla and WordPress installation files or simple html files.

After you have changed a file in this folder, you do not need to restart the server - just in the browser in which your page is open, press the F5 key to reload it.

Let's look at a small example in which we display a test page. To create it, you can use a regular text editor, such as Windows Notepad. In this example, in addition to creating the usual HTML markup, we, using PHP, will display a test welcome line.

Open windows notepad and type the following piece of code:

If you are too lazy to type - copy the code and paste it into the open text editor window and save the file with the name index.php in folder C: wamp www

After saving, go to the browser window and refresh the page of your site by pressing F5.

By default, your site is accessible only from the local computer, that is, from the machine on which it is installed. For the rest, the server will deny access with the code “403 Forbidden”.

If you need to provide access to your site to other people who connect remotely, in this case you need to make changes to the Apache server configuration file. To do this, right-click the WampServer icon and select the httpd.conf configuration file in the Apache folder in the context menu.

Scroll down to the section starting with find the following two lines:

Save your changes and restart the Apache server.

Your site should now be accessible from other computers. If you use a router, make sure that port 80 is forwarded on it, because without this your site will not be visible from the Internet.

Do I need a local server

For beginners, I’ll start by defining the concept of “local server” - this is a server (hosting) that is located on your computer (not on the Internet) and allows you to create and configure sites on it.

I believe that the creation and further configuration of the site should be done on the local server, so that then in one fell swoop to place a fully functional site with all the settings on the Internet. And then immediately fill it with content.

So do really professionals in creating sites. Even if we look at people who are constantly working on creating sites on various engines, we will see that almost every one of them first installs the site on a local server, then configures it, and only then transfers it to real hosting.

As an example, I will show the menu from the course of Sergey Patin "Joomla 3 - a professional website in one day." Look at the sequence in which the site is being created.

As you can see, from the very beginning the site is installed locally, configured, and at the end a completely ready resource for hosting is transferred.

It is unreasonable to place a site on the Internet, and then engage in its configuration, when you need to promote it already.

And if you already have a website? Do you need a local server?

Let's imagine the situation that you already have a website and you are a very avid techie, that is, you like to delve forever in all sorts of technical moments and constantly experiment something.

So, you already have a site and there are already some visitors on it. Although not a large number, but they are. Put yourself in their place.

You go to the site and constantly see that the owner of the site or blog is constantly changing something. Changes the arrangement of blocks on the site, structure, and it happens that the design is new every day. Would you like that? So visitors would not really like this situation.

Engage in the development, configuration of sites, as well as creating designs on a site that is already posted on the Internet, at least not professionally. Not to mention the fact that it adversely affects its development and approval in the eyes of search engines and your audience.

Therefore, you need to do all such things on your local computer.

Now we will begin to install it, after which you can install your site on the local computer and do whatever you want with it. Visitors to these frauds will not see, because it is your personal computer and no one has access to it. And after everything is brought to its final state, you can transfer it to a real site without any problems.

By the way, I also speak about the importance of the local server when creating a blog in my intellect map "Plan for creating a quality blog from Konstantin Khmelev", which you can get by leaving your 1st comment.

We proceed to the installation process.

Install the local server on your computer

The local server is a program. Therefore, you must download it. We will use the Denwer web server for this.

We go to the official website of the program and click on the big button.

After clicking, it is proposed to select the version of the program. Choose a version old PHP 5.2 and click on the button Download.

In the next window, we need to enter the data where the link to download Denwer will be sent. Enter your real data and click on the "Get Download Link" button.

After clicking on the button, an e-mail with a link to download the program will immediately come to your mail. The sender and subject of the letter will be like this (see the screenshot below).

By going to the letter, the link itself will be, by clicking on which, we download the installer of the program to the computer.

After downloading, in the place of saving the program you will see the installer, which will look like this.

To start the installation of the local server, run the installer.

We are asked if we want to install the basic package? We agree.

Unzipping data will begin, which will go very quickly.

After unpacking the data, the installation of the local server will begin, which will be carried out on the command line. Immediately upon its launch, we will be asked to close the browser.

Automatic when a command line appears, a browser will open with a message that to continue or cancel the installation, you must close the browser.

After closing all Internet browsers, installation will continue. You just need to follow the prompts given by the command line.

To continue the installation, press Enter.

Next, you need to select the installation location of the local server. By default, it is installed on the path "C: WebServers". You can not change this path.

I’ll install it in another place. In my case, this is a disk E folder host.

Next we will be asked if we really want to install Denwer in this director. We agree. To do this, enter the letter at the command prompt Ywhich means YES (Yes) and click Enter.

In the next step, press Enter again.

The next step is to select the letter of the virtual disk. By default, the program offers to select the Z drive, since this letter is the last in the English alphabet and hardly any disk is occupied by it.

I will leave it that way. You can enter another letter, but make sure that no disk is occupied by it.

After selecting and entering a letter, press Enter to continue installing the local server.

Next, we continue the installation by pressing the Enter key, after which the copying of files to the directory selected in the previous step will begin.

After copying is complete, you must select the Denwer startup option.

There are 2 launch modes, but the program itself recommends choosing option 1. We do this. Enter the number 1 in the command line and press Enter.

Next, you need to choose whether shortcuts are created on the desktop to control Denwer, namely:

We need these shortcuts. Therefore, drive the letter Y and press Enter.

This was the last stage of the local server installation, after which the browser automatically opens with the inscription "Denver successfully installed", and it will also be written that Denwer works with the same ports as Skype.

Therefore, if you have skype installed, then do what will be written in the browser window.

Also, shortcuts on the desktop that we wanted so much will be created.

  1. Start Denwer - start Denver,
  2. Stop Denwer - stop
  3. Restart Denwer - reboot.

Everything. Our local server is installed. Now it remains to check it a little. Run and see if our virtual disk, which will act as a local server, really starts.

Before starting, let's go to the directory where we installed Denver and see what is located there.

Since I installed on drive E in the host folder, now there should be such a folder on my drive.

The way it is. And inside the folder should be the denver files themselves. We go inside the folder where we should see the next picture.

There are files. So everything was successfully copied during installation.

Now check to see if Denwer starts up. Use the shortcut to start.

After starting the shortcut, 2 command lines quickly flash. When they disappear, 2 shortcuts will appear on the taskbar.

If such shortcuts appeared, then Denwer is running. A virtual disk with the letter Z should also appear in my case. In your case, with the letter that you have assigned. Also, this disk should be called similarly to the disk in which you installed the denver itself.

As you can see, there is a drive "E" in which I performed the installation, as well as a drive "Z", which appeared after starting the denver. Their names are the same. Оба диска имеют название "Локальный диск". Только буквы разные.

Если перейдем в виртуальный диск (Z), то должны увидеть те же файлы и папки денвера, который мы смотрели ранее.

Все, друзья. На этом установка локального сервера закончилась. Теперь можно приступать к созданию сайта на нем и делать с сайтом любые махинации.

В следующей статье я покажу, как установить движок WordPress на локальный сервер. Вас там также ждет подробная статья с изображениями и видео-уроком.

Кстати про видео-урок. Если кому-то, что-то непонятно по текстовой версии, то вот даю видео-урок, который специально записал для вас.

На этом я с вами попрощаюсь. Жду ваших комментариев и каких-то идей для новых статей блога. Если что-то не получается или остались какие-то вопросы, пишите их в комментариях.

List of used parameters:

Options The following options are possible:

  • Includes - SSI allowed
  • IncludesNOEXEC - SSI is allowed with restrictions (#include and #exec are not allowed),
  • Indexes - the use of index files is allowed, and if the URL points to the directory of the site (for example, www.domain.com/dir/) in which the index file does not exist, the contents of this directory will be displayed, and if this option is not available, a notification is issued that access is denied
  • ExecCGI - CGI script execution is allowed,
  • FollowSymLinks - the server follows the existing symbolic links of the directory (used in Unix systems),
  • SymLinksIfOwnerMatch - the server follows the available symbolic links of the directory only if the target file has one owner with a link,
  • All - all of the above together is allowed,
  • None - all of the above together is prohibited,
  • MultiViews - the ability to select specific content and display it depending on the preferences of the browser (even if everything is enabled (Options All). Specified separately).

  • AuthConfig - allows you to use directives for authorization,
  • FileInfo - allows the use of directives for working with various types of documents,
  • Indexes - allows the use of directives for working with index files,
  • Limit - allows the use of directives to determine access to the host,
  • Options - allows the use of directives to work with certain specific functions of directories,
  • All - all of the above together,
  • None - none of the above together.

  • Deny, Allow - Deny is defined before the Allow directive, access is allowed by default, except for hosts that are indicated in the line after Deny from,
  • Allow, Deny - Allow is defined before the Deny directive, access is denied by default, except for hosts that are listed in the line after Allow from,
  • Mutual-failure - only hosts that are not present in Deny and are present in Allow are allowed access.

Based on the foregoing, try setting up your server. In the httpd.conf file, the Directory directive by default exists in two instances at once - and. The first option should not be touched, so in the second set the parameters as follows:

In other words, the following options were selected for the C: / www folder and all its subfolders:

  • Of the possible functionality of the existing server, indexes in directories and transitions to symbolic links are allowed,
  • The ability to parametrically override using .htaccess files is completely absent, however, given that you have full access to the server, it is not relevant - everything can be configured via httpd.conf,
  • Access to the web server is allowed from all hosts.

Now, save the httpd.conf file and restart Apache using Apache Monitor or the apache –k restart command on the command line. Site root folder configuration is complete.

You should check whether you did everything correctly. Create a simple web page in the C: www folder, open your browser and enter http://127.0.0.1/your_created_page. Pages should open. Otherwise, it is necessary to carefully check all changes in the httpd.conf file for correctness.

If the page opens successfully, there is a chance that instead of Cyrillic characters you will see unreadable characters. They can be displayed for two reasons. First, the web server provides your browser, which requested the page, with the default encoding. Secondly, oddly enough, this encoding is not Cyrillic.

If the notorious Internet Explorer in such cases determines the encoding from the page itself, then, for example, Mozilla Firefox and Opera have absolutely no inclination for such actions, and the way to manually set the encoding in the browser can hardly be called convenient. Therefore, you must configure Apache to provide the default encoding required.

Find the line that begins on AddDefaultCharset in the httpd.conf file. Most likely, the ISO-8859-1 encoding is indicated there, in which there are no Cyrillic characters. Change ISO-8859-1 to windows-1251, save the file and restart Apache. Now the correct display of the Russian language on your site will work in any browser.

In the Apache server, it’s simple enough to configure work with several sites. The addresses that can be used for them are 127.0.0.2, 127.0.0.3, etc. At the same time, only the one that is the default site (127.0.0.1) will be visible on the network, however, this is not critical for local operation. The section of the httpd.conf file in which everything necessary for this is configured is located at the very end and is called VirtualHosts.

In order to add an additional site, create a directory that is used as its root, for example, C: www2. Assuming that the site will respond to the address 127.0.0.2, give it the name site911 and add the following lines at the very end of the VirtualHosts section:

Restart the Apache server. By typing 127.0.0.1 in the address bar of the browser, you will be taken to your first local site, and by typing 127.0.0.2 - to the second local site. It should be borne in mind that absolutely every Apache web server directive can be used inside each VirtualHosts container, so you can configure each site in the best way.

Installation and configuration is completed, and now you can fully begin to study the operation of the Apache server in practice.

If you decide to closely engage in website administration, your next step should be to study the Apache PHP MySQL bundle, because without a database management system, as well as without support for one of the most common web programming languages ​​and a web-based tool for administering the MySQL system, cost no server in the vastness of the world wide web. As the saying goes, "hard in learning, but easy in battle."

We wish you good luck in studying this difficult, but interesting business!

Pin
Send
Share
Send
Send