Denwer (local web server). Deploying a local server on Windows

For many years, I had Linux on my laptop, and I always ran a web server on it to test sites, finish templates, and so on. But time moves forward, today my main system is Windows 10, since Linux, although better, cannot run many necessary programs in it. And today I was faced with a question: how to install a local server on Windows?

The need arose after I discovered (with horror) that on this blog there are more than seven H1s in each article - this is a NIGHTMARE! Two H1s on one page are already bad, but here there are so many!

As you can see, all the headers in the sidebar in my template are made using H1 - the programmer who wrote the template would rip his hands off, he is clearly not familiar with the basics of SEO.

But what do headers and the web server have to do with it? And the connection is this: all my sites are cached outside the server, on the server, and also . I change something on the site, but I don’t see the result, or I see it only after a while. As you can imagine, this is very inconvenient!

Besides, it’s not very good to torment the site while it’s working, people read it there, and here are my experiments. Therefore, I decided to now install a web server for Windows to fix this jamb, and then all the others, there are still enough of them, I think, since such a master felt-tip pen made my template 😉

How to install apache server on windows?

In Linux, everything was done simply, I described how to install the LAMP web server there in THIS article. This is an alien environment for me, I’ve only heard about Denwer, but have never really worked with it. But as it turned out, not only can you use it to install the Apache server on Windows, there is also XAMPP .

I will not describe how it is deciphered and how everything works inside, for me the main thing is that it all works AT ALL. Everything is still in Russian, which is nice. Everything is also available for the main platforms, which is even more pleasing, since the latest version of Apache on Linux brought me a lot of trouble, I was tired of setting it up. Download the package we need and install it.

I didn’t download the latest version, I settled on the middle one, everything new has a tendency to glitch and show incompatibility. I downloaded it and immediately noticed on the site that there were also plugins for this web server, for example, my favorite WordPress. Here is the page from which you can download extensions for web server on windows XAMMP.

And then the developers warn (machine translation) that many things will not work with the seventh version of PHP - this is what I was talking about, how I felt. I download the WordPress add-on, it’s the only one I need for now, and I install it. And look here:

The program offers us to install a bunch of unnecessary garbage that will slow down my computer: I only need Apache, MySQL, phpMyAdmin and PHP. I simply don’t need everything else, so I unchecked the extra boxes.

I advise you to install the Apache web server for Windows on drive D, not C, if you then reinstall the system, all files will be saved. Now I install the WordPress add-on. When installing, specify the Russian language. Next we get this window - you need to configure the web server itself.

But nothing worked for me right away and I understood why - I did not start the web server itself. So I went to the menu, found the server shortcut and saw this window:

I started the server manually (strat buttons) and thought: how good it is that the server does not start when the computer starts, as it was in Linux - the memory is not rubber, and unnecessary processes are not needed, because I will not use the server every day!

Well, the job is done, now you need to upload your theme and all the plugins to it and start making it perfect. This is how I installed Apache web server for Windows in 10 minutes (not counting writing the article). Everything is simpler than I thought.

Yes, what’s also important, WordPress itself is located here - D:\SERVER FOLDER\apps\wordpress\htdocs - it wasn’t so easy to find, so I’ll make it easier for you 😉

I will write about all the nuances of working with it in the comments; if it doesn’t work out, ask, I’ll try to help!

WEBMASTER ADVICE: The ability to make money on the Internet is only half the battle, the other half is the ability to PROFITABLY cash out electronic money. Here is a list of offshore bank cards to which you can withdraw funds and then withdraw crisp bills from them:

1. Payoneer- The world's most popular payment system for freelancers. Issues cards, located in the USA.

2. EpayService- The American payment system, very popular in many countries, provides a MasterCard card in EVRO for free for residents of the CIS and Europe.

3. Skrill- The only payment system that works with cryptocurrencies and at the same time issues free MasterCard bank cards.

4. AdvCash- The offshore bank is located in Belize, you can open an account in dollars, euros, pounds and rubles.

5. Payeer- The headquarters of this payment system is located in Georgia, here you can also open an account in dollars, euros and rubles.


Domain RU - 99 RUR
Domain RF - 99 RUR

Hello, today we’ll talk about choosing and creating a local server on your computer (localhost), which any webmaster needs to test a dynamic site (its modules, plugins, themes, templates, engine updates, etc.) on a computer, and not on an Internet hosting service, that is, you can test the site even without an Internet connection.

You can download the sources for the article below

Sites on engines (wordpress, joomla, Bitrix, etc.) are dynamic sites, unlike static sites - they cannot be opened on a computer through a regular browser, to edit and view them you need to install a local server (localhost) on your computer - “ program” - which will create hosting on your computer - after which you will be able to view the dynamic site through a regular browser, even without an Internet connection.

Which local server (localhost) should I choose?

1. Denwer (Denver) (“denwer.ru/”)

Denver – free local server for Windows.
Created by Russian programmers!
The site contains a video in Russian on installing and configuring a local server - Denver.
The project accepts donations - so it’s worth supporting the domestic manufacturer!

2. MAMP (“mamp.info/en/”)
MAMP stands for Macintosh, Apache, MySQL and PHP.
MAMP is free, but there is also a paid version that allows you to install multisite mode for WordPress (MultiSite).
MAMP developed for OS X operating system(successor to Apple's Mac OS), but there is also a beta version available for Windows.

3. XAMPP (“apachefriends.org/ru/index.html”)
XAMPP is the most popular PHP development environment, it is free and open source, developed for Windows, OS X and Linux.
Allows you to create WordPress MultiSite sites.

The website and instructions for XAMPP have been translated into many languages, including Russian.

This product has an extension for various engines called – Bitnami is a free all-in-one tool for installing Drupal, Joomla, WordPress, etc.

“bitnami.com/”

What platforms does Bitnami work on:

Operating Systems: Windows, OS X and all Linux distributions, including Red Hat Enterprise Linux, CentOS, Amazon, Linux, Ubuntu, Fedora, Debian, etc.
Virtualization platforms: VMWare, VirtualBox, Xen, KVM, Parallels, others
Cloud platforms: Amazon Web Services, Microsoft Azure, VMWare vCloud, OpenStack, CloudStack, others.

Bitnami is amazingly easy to install and use!

For website developers using the WordPress engine, Bitnami can be downloaded here:
“bitnami.com/stack/wordpress”

4. DesktopServer (serverpress.com/”)
An excellent free product that allows you to create a local server in 5 minutes.
The free version allows you to create 3 websites and you cannot use MultiSite for WordPress - all these restrictions are removed in the paid version of the product.

5. WampServer (wampserver.com/ru/)

WampServer is a Windows web development platform for dynamic web applications using Apache2 server, PHP script interpreter and MySQL database.
Website and installation instructions in Russian.

Users of WordPress sites will also be interested in the following information products:

1. Duplicator plugin

Available on “wordpress.org”:

Number of downloads: 745,009 – a lot of downloads!

Plugin website: “wordpress.org/plugins/duplicator/”

A free and popular plugin, it allows you to clone a WordPress site for use elsewhere. Needed to create an exact copy of your site to use as a testing environment on your local computer or on your hosting account.
Creating an exact copy of your site will allow you to test plugins, themes, and even WordPress engine updates before making changes to the real website.
Unfortunately, this plugin does not support MultiSite.

2. Sandbox plugin

Available on “wordpress.org”:

Number of downloads: 1,883

Plugin website: “wordpress.org/plugins/sandbox/”

The plugin creates an exact copy of a WordPress site on your existing hosting, allowing you to test changes independently of your real site, the changes will be hidden from visitors and search engines.

Another interesting product:
3. Instant WordPress (“instantwp.com”)

Instant WordPress is a portable WordPress development environment.

A video about how to easily and quickly install and use this product can be viewed here:

“instantwp.com/documentation/video/”

That's all!

A few days ago I was once again visited by a thought. The idea was not new and quite intrusive: “let's switch to Windows8. Well please." And since there was no way to drive her away, I stocked up on tea and cookies and got started.

It took no more than two hours to install the system and all the necessary programs, but then the most interesting moment came: I needed to deploy a working environment, namely GIT + local server (Apache, MySQL, PHP, nginx, memcached, mongodb). Remembering the experience of previous installations, this time I decided to document the entire process and save it for posterity.

Disclaimer number one:“I’m not a programmer” (c), but an interface designer and front-end technologist (but in some cases I can help my colleagues and code something like that, and even then they won’t beat me for it)

Disclaimer number two: Yes, I perfectly imagine that in Ubuntu all this is done much faster. But I work on Windows, this is how it historically happened.

So let's get started.

Our work plan includes installation of the following products:

  1. PuTTY
  2. Denwer (Apache, MySQL, PHP)
  3. Nginx
  4. Memcached
  5. MongoDB

1. PuTTY

PuTTY- a freely distributed client for various remote access protocols, including SSH, Telnet, rlogin.

PuTTY includes several utilities, but in my work I only need it and Pegeant (an SSH authentication agent that stores keys to git repositories).
Offsite:
If you don't need any SSH, forget about this point and move on.

2.GIT

To work with git I've been using it for years now TortoiseGit, which is stable, flexible and covers all my needs by 146%. In general, I recommend it.


Offsite:

2.1 TortoiseGit requires git for Windows, which can be picked up on Googlecode;
2.2 myself TortoiseGit install from here

3. Denwer

Denver- A gentleman's kit for a Web developer (“Dn.w.r”, read “Denver”) - a project by Dmitry Koterov, a set of distributions (Apache, PHP, MySQL, Perl, etc.) and a software shell used by Web- developers to develop websites on a “home” (local) Windows machine.
Offsite:

3.1 Installation

We will need to download basic kit and additional PHP5 modules.

Lyrical digression:

no, not just download, but receive download links by email! That is, you will have to enter your email, as well as your first and last name, twice in the form under the large “Registration” heading. “Registration is required due to the future release of Denver 4.” For many years now the form has been apologizing, but I don’t believe it anymore(.

Usually, installing Denver is quick and painless, but on Windows8 I was attacked by an error that complained about a missing library msvcr71.dll. You can put the library in a folder "\Windows\System32\"(x32) or "\Windows\SysWOW64\"(x64). After the file is in the folder, open its properties and click the “Unblock” button.

3.2 Functional check

After installing Denver, we will create a test script, which will be used to check the functionality of everything that we will install later.
Let's go to Z:\home and add a new site: create a folder test.local, there is a folder in it "www", to which we add the file index.php with incredibly creative text:

";

Restart Denver, open in browser www.test.local, get impressed and move on

4. Memcached

Memcached- middleware that implements a data caching service in RAM based on the hash table paradigm.

Memcache- PHP extension, provides a convenient procedural and object-oriented interface to memcached, a highly efficient caching daemon that was specifically designed to reduce database load in dynamic web applications.

4.1 Installing memcached

A. download the archive with the binary: Memcached 1.4.5 for Windows from here
IN. \usr\local\memcached

4.2 Installing memcache

A. download the archive with the library from here
IN. unpack the contents of the archive into \usr\local\php5\ext\
WITH. open the file php.ini (\usr\local\php5\php.ini) and connect the extension:
extension=php_memcache.dll

4.3 Configuring the launch of Memcached along with the launch of Denwer

To run the script with Denver we need:
  1. write a script containing commands to start and stop the application/service and put it in a folder \denwer\scripts\init.d
  2. create a link to this script in the startup/stop configuration folder \denwer\scripts\main\

A. create a file named “memcached.pl” in the directory \denwer\scripts\init.d\
#!perl -w package Starters::Memcached; BEGIN ( unshift @INC, "../lib"; ) use StartManager; my $basedir = "/usr/local/memcached/"; chdir($basedir); StartManager::action $ARGV, start => sub ( ### ### START. ### print "Starting memcached\n"; system("memcached.exe -d"); print " Started!\n"; ), stop => sub ( ### ### STOP. ### print "Stopping memcached\n"; system("TASKKILL /F /IM memcached.exe"); print " Stopped!\n"; ); return 1 if caller;

B. Now let's create a link to the script - a regular text file containing instructions that when starting, restarting and stopping Denver, you must execute init.d/memcached.pl
We write in a text editor
init.d/memcached
and save the file under the name "40_memcached" to the following folders:

  • \denwer\scripts\main\start
  • \denwer\scripts\main\stop
  • \denwer\scripts\main\restart

4.4 Checking the result

We add to our test script (index.php):
$memcache = new Memcache; $memcache->connect("127.0.0.1", 11211); echo 'Memcache ver: ' . $memcache->getVersion();

Let's restart Denver and see what happens

5. Nginx

Nginx- a simple, fast and reliable server, not overloaded with functions.

Offsite:

5.1 Setting up Nginx

A. download the Windows version from the offsite and unpack it into \usr\local\nginx
B. setting up a virtual host for our test site. For this we open \usr\local\nginx\conf\nginx.conf and add it there

Server ( listen 127.0.0.1:80; server_name www.test.local test.local; if ($host = "test.local")( rewrite ^/(.*)$ http://www.test.local$1 permanent ; ) location ~* \.(jpeg|jpg|gif|png|css|js|pdf|txt|tar)$ ( root Z:\home\/test.local\www; ) location / ( ssi on; proxy_pass http ://127.0.0.1:8080/; proxy_set_header $request_uri; proxy_set_header $remote_addr; proxy_set_header $host; proxy_connect_timeout 90; out 90; proxy_redirect off; proxy_set_header Connection; proxy_pass_header Content-Disposition; proxy_pass_header Content-Length; root Z:\home\/test.local\www;
This is an example of settings from a real project, your settings may obviously vary.

5.2 Setting up Apache

By default, Apache runs on port 80, but we just gave this port to Nginx, so now we need to change the template for the virtual host in the Apache settings and assign it a port other than 80 (for example, 8080).
Opening \usr\local\apache\conf\httpd.conf and change the port number

## ## START OF VIRTUAL HOST TEMPLATE. ## ## If you want Apache to run on a port other than 80 by default, ## change the port number in the next directive. ## #Listen $&(ip:-127.0.0.1):$&(port:-8080) #NameVirtualHost $&(ip:-127.0.0.1):$&(port:-8080) # # DocumentRootMatch "/home/(?!cgi-)(.*)^1/(?!cgi$|cgi-)(.*)" # DocumentRootMatch "/home/(?!cgi-)(.*)/ public_html^1" # DocumentRootMatch "/home/(?!cgi-)(.*)/public^1" # DocumentRootMatch "/home/(?!cgi-)(.*)^1/html/(.*) " # DocumentRootMatch "/home/(?!cgi-)(.*)^1/domains/(?!cgi$|cgi-)(.*)" # DocumentRootMatch "/var/www/html/(?!cgi -)~(.*)^1/(?!cgi$|cgi-)(.*)" # DocumentRoot "$&" # ServerName "%&/-www" # ServerAlias ​​"%&/-www" "% &/-www/www" $&(host:-) # # $&(directives:-) # # ScriptAlias ​​/cgi/ "$^1/cgi/" # ScriptAlias ​​/cgi-bin/ "$^1/cgi -bin/" # AllowEncodedSlashes on #

5.3 Configuring Nginx launch along with Denwer launch

A. create a file named “nginx.pl” in the directory \denwer\scripts\init.d\
#!perl -w package Starters::Nginx; BEGIN ( unshift @INC, "../lib"; ) use StartManager; my $basedir = "/usr/local/nginx/"; chdir($basedir); StartManager::action $ARGV, start => sub ( ### ### START. ### print "Starting Nginx\n"; system("start nginx.exe"); print " Started!\n"; ) , stop => sub ( ### ### STOP. ### print "Stopping Nginx\n"; system("nginx.exe -s stop"); print " Stopped!\n"; ); return 1 if caller;

B. write in a text editor
init.d/nginx
and save the file under the name "50_memcached" to the following folders:

  • \denwer\scripts\main\start
  • \denwer\scripts\main\stop
  • \denwer\scripts\main\restart

5.4 Checking the result

Place the file next to the script style.css with content
h1( color: red; ) h2( color: green; )

And we will ennoble our index.php:
Test me

Test me

Memcached

connect("127.0.0.1", 11211);
echo "Memcached ver: " . $memcache->getVersion();

?>

Now we restart Denver and admire the result. If the CSS file is connected, Nginx works fine. 6. MongoDB

Offsite:

MongoDB

A.- a document-oriented database management system (DBMS) with open source code that does not require a description of the table schema. 6.1 PHP driver Download the library \usr\local\php5\ext\
php_mongo.dll from this site: and put it in a folder Through trial and error, it was found that a suitable driver is contained in the archive

B. mongo-1.2.5.zip/mongo-1.2.5-php5.3vc9ts.zip php.ini
. If for some reason it doesn’t start for you, try other versions.

connect the extension to

extension=php_mongo.dll 6.2 Installing Mongo A. download the archive from Mongo and unpack it into a folder

B.\usr\local\mongodb
. In the same folder we create two more folders:
install the service

> cd C:\WebServers\usr\local\mongodb\bin\

A.> mongod.exe --install --dbpath=C:\WebServers\usr\local\mongodb\db\ --logpath=C:\WebServers\usr\local\mongodb\logs\ 6.3 Setting up MongoDB to launch in conjunction with Denver create a file with the name \denwer\scripts\init.d\
"mongod.pl"

B. in the directory
#!perl -w package Starters::mongoDB; BEGIN ( unshift @INC, "../lib"; ) use StartManager; StartManager::action $ARGV, start => sub ( ### ### START. ### print "Starting mongoDB\n"; system("net start mongoDB"); print " Started!\n"; ), stop => sub ( ### ### STOP. ### print "Stopping mongoDB\n"; system("net stop mongoDB"); print " Stopped!\n"; ); return 1 if caller;
and save the file under the name write in a text editor init.d/mongod

  • \denwer\scripts\main\start
  • \denwer\scripts\main\stop
  • \denwer\scripts\main\restart

"60_mongod"

to folders already familiar to us:
6.4 Checking the result

Let's launch the mongo console interface
> Z:\usr\local\mongodb\bin\mongo.exe
And we will insert and output the test value into the “test” database

> db.test.save(( name: “Habr!” ))

> db.test.find()

There is a list and short reviews of admin panels on the MongoDB website, so you can choose according to your taste.
I chose RockMongo for myself, so with its help we will finally make sure that everything works for us and does not crash anywhere.

A. download the archive with the admin panel from this page. Naturally, we choose Windows version. At the time of writing this article RockMongo-on-Windows v0.0.4

B. take a folder from the archive \rockmongo-on-windows\web\rockmongo and copy it to the directory of our test site
Opening config.php and change the value of the parameter
$MONGO["servers"][$i]["control_auth"] = true;
on
$MONGO["servers"][$i]["control_auth"] = false;

C. Check the result using the link www.test.local/rockmongo/index.php

Congratulations! Now we are completely and irrevocably well done.

Bonus #1. Working with php from the Windows console

Perhaps it will be useful to someone. It came in handy for me when our evil tech lead decided that “SQL files are a thing of the past, let’s use migrations.” Of course, for the sake of decency, I tried to feign complete misunderstanding and even shed a tear, but I was exposed and sent to figure out how it works on Windows.
It turned out that all you need for happiness is add PHP directory to PATH.


Click on “Edit” and add to the end of the line
;Z:\usr\local\php5

Now let's check that everything worked.
Let's create a file in the directory of the test site console.php

Open the console(you can directly from the same folder - right-click with SHIFT pressed on an empty space and select “Open command window”).
Enter:
> php console.php “UserName”

The console responds:
> “Hello, UserName!”

PHP is defeated, general rejoicing, applause, curtain.

Bonus #2.

All files and examples mentioned in the article in one archive for free without SMS: on Github

I hope that this material will be useful.
I would be grateful for comments and suggestions.

Tags: Add tags

A few days ago I was once again visited by a thought. The idea was not new and quite intrusive: “let's switch to Windows8. Well please." And since there was no way to drive her away, I stocked up on tea and cookies and got started.

It took no more than two hours to install the system and all the necessary programs, but then the most interesting moment came: I needed to deploy a working environment, namely GIT + local server (Apache, MySQL, PHP, nginx, memcached, mongodb). Remembering the experience of previous installations, this time I decided to document the entire process and save it for posterity.

Disclaimer number one:“I’m not a programmer” (c), but an interface designer and front-end technologist (but in some cases I can help my colleagues and code something like that, and even then they won’t beat me for it)

Disclaimer number two: Yes, I perfectly imagine that in Ubuntu all this is done much faster. But I work on Windows, this is how it historically happened.

So let's get started.

Our work plan includes installation of the following products:

  1. PuTTY
  2. Denwer (Apache, MySQL, PHP)
  3. Nginx
  4. Memcached
  5. MongoDB

1. PuTTY

PuTTY- a freely distributed client for various remote access protocols, including SSH, Telnet, rlogin.

PuTTY includes several utilities, but in my work I only need it and Pegeant (an SSH authentication agent that stores keys to git repositories).
Offsite:
If you don't need any SSH, forget about this point and move on.

2.GIT

To work with git I've been using it for years now TortoiseGit, which is stable, flexible and covers all my needs by 146%. In general, I recommend it.


Offsite:

2.1 TortoiseGit requires git for Windows, which can be picked up on Googlecode;
2.2 myself TortoiseGit install from here

3. Denwer

Denver- A gentleman's kit for a Web developer (“Dn.w.r”, read “Denver”) - a project by Dmitry Koterov, a set of distributions (Apache, PHP, MySQL, Perl, etc.) and a software shell used by Web- developers to develop websites on a “home” (local) Windows machine.
Offsite:

3.1 Installation

We will need to download basic kit and additional PHP5 modules.

Lyrical digression:

no, not just download, but receive download links by email! That is, you will have to enter your email, as well as your first and last name, twice in the form under the large “Registration” heading. “Registration is required due to the future release of Denver 4.” For many years now the form has been apologizing, but I don’t believe it anymore(.

Usually, installing Denver is quick and painless, but on Windows8 I was attacked by an error that complained about a missing library msvcr71.dll. You can put the library in a folder "\Windows\System32\"(x32) or "\Windows\SysWOW64\"(x64). After the file is in the folder, open its properties and click the “Unblock” button.

3.2 Functional check

After installing Denver, we will create a test script, which will be used to check the functionality of everything that we will install later.
Let's go to Z:\home and add a new site: create a folder test.local, there is a folder in it "www", to which we add the file index.php with incredibly creative text:

";

Restart Denver, open in browser www.test.local, get impressed and move on

4. Memcached

Memcached- middleware that implements a data caching service in RAM based on the hash table paradigm.

Memcache- PHP extension, provides a convenient procedural and object-oriented interface to memcached, a highly efficient caching daemon that was specifically designed to reduce database load in dynamic web applications.

4.1 Installing memcached

A. download the archive with the binary: Memcached 1.4.5 for Windows from here
IN. \usr\local\memcached

4.2 Installing memcache

A. download the archive with the library from here
IN. unpack the contents of the archive into \usr\local\php5\ext\
WITH. open the file php.ini (\usr\local\php5\php.ini) and connect the extension:
extension=php_memcache.dll

4.3 Configuring the launch of Memcached along with the launch of Denwer

To run the script with Denver we need:
  1. write a script containing commands to start and stop the application/service and put it in a folder \denwer\scripts\init.d
  2. create a link to this script in the startup/stop configuration folder \denwer\scripts\main\

A. create a file named “memcached.pl” in the directory \denwer\scripts\init.d\
#!perl -w package Starters::Memcached; BEGIN ( unshift @INC, "../lib"; ) use StartManager; my $basedir = "/usr/local/memcached/"; chdir($basedir); StartManager::action $ARGV, start => sub ( ### ### START. ### print "Starting memcached\n"; system("memcached.exe -d"); print " Started!\n"; ), stop => sub ( ### ### STOP. ### print "Stopping memcached\n"; system("TASKKILL /F /IM memcached.exe"); print " Stopped!\n"; ); return 1 if caller;

B. Now let's create a link to the script - a regular text file containing instructions that when starting, restarting and stopping Denver, you must execute init.d/memcached.pl
We write in a text editor
init.d/memcached
and save the file under the name "40_memcached" to the following folders:

  • \denwer\scripts\main\start
  • \denwer\scripts\main\stop
  • \denwer\scripts\main\restart

4.4 Checking the result

We add to our test script (index.php):
$memcache = new Memcache; $memcache->connect("127.0.0.1", 11211); echo 'Memcache ver: ' . $memcache->getVersion();

Let's restart Denver and see what happens

5. Nginx

Nginx- a simple, fast and reliable server, not overloaded with functions.

Offsite:

5.1 Setting up Nginx

A. download the Windows version from the offsite and unpack it into \usr\local\nginx
B. setting up a virtual host for our test site. For this we open \usr\local\nginx\conf\nginx.conf and add it there

Server ( listen 127.0.0.1:80; server_name www.test.local test.local; if ($host = "test.local")( rewrite ^/(.*)$ http://www.test.local$1 permanent ; ) location ~* \.(jpeg|jpg|gif|png|css|js|pdf|txt|tar)$ ( root Z:\home\/test.local\www; ) location / ( ssi on; proxy_pass http ://127.0.0.1:8080/; proxy_set_header $request_uri; proxy_set_header $remote_addr; proxy_set_header $host; proxy_connect_timeout 90; out 90; proxy_redirect off; proxy_set_header Connection; proxy_pass_header Content-Disposition; proxy_pass_header Content-Length; root Z:\home\/test.local\www;
This is an example of settings from a real project, your settings may obviously vary.

5.2 Setting up Apache

By default, Apache runs on port 80, but we just gave this port to Nginx, so now we need to change the template for the virtual host in the Apache settings and assign it a port other than 80 (for example, 8080).
Opening \usr\local\apache\conf\httpd.conf and change the port number

## ## START OF VIRTUAL HOST TEMPLATE. ## ## If you want Apache to run on a port other than 80 by default, ## change the port number in the next directive. ## #Listen $&(ip:-127.0.0.1):$&(port:-8080) #NameVirtualHost $&(ip:-127.0.0.1):$&(port:-8080) # # DocumentRootMatch "/home/(?!cgi-)(.*)^1/(?!cgi$|cgi-)(.*)" # DocumentRootMatch "/home/(?!cgi-)(.*)/ public_html^1" # DocumentRootMatch "/home/(?!cgi-)(.*)/public^1" # DocumentRootMatch "/home/(?!cgi-)(.*)^1/html/(.*) " # DocumentRootMatch "/home/(?!cgi-)(.*)^1/domains/(?!cgi$|cgi-)(.*)" # DocumentRootMatch "/var/www/html/(?!cgi -)~(.*)^1/(?!cgi$|cgi-)(.*)" # DocumentRoot "$&" # ServerName "%&/-www" # ServerAlias ​​"%&/-www" "% &/-www/www" $&(host:-) # # $&(directives:-) # # ScriptAlias ​​/cgi/ "$^1/cgi/" # ScriptAlias ​​/cgi-bin/ "$^1/cgi -bin/" # AllowEncodedSlashes on #

5.3 Configuring Nginx launch along with Denwer launch

A. create a file named “nginx.pl” in the directory \denwer\scripts\init.d\
#!perl -w package Starters::Nginx; BEGIN ( unshift @INC, "../lib"; ) use StartManager; my $basedir = "/usr/local/nginx/"; chdir($basedir); StartManager::action $ARGV, start => sub ( ### ### START. ### print "Starting Nginx\n"; system("start nginx.exe"); print " Started!\n"; ) , stop => sub ( ### ### STOP. ### print "Stopping Nginx\n"; system("nginx.exe -s stop"); print " Stopped!\n"; ); return 1 if caller;

B. write in a text editor
init.d/nginx
and save the file under the name "50_memcached" to the following folders:

  • \denwer\scripts\main\start
  • \denwer\scripts\main\stop
  • \denwer\scripts\main\restart

5.4 Checking the result

Place the file next to the script style.css with content
h1( color: red; ) h2( color: green; )

And we will ennoble our index.php:
Test me

Test me

Memcached

connect("127.0.0.1", 11211);
echo "Memcached ver: " . $memcache->getVersion();

?>

Now we restart Denver and admire the result. If the CSS file is connected, Nginx works fine. 6. MongoDB

Offsite:

MongoDB

A.- a document-oriented database management system (DBMS) with open source code that does not require a description of the table schema. 6.1 PHP driver Download the library \usr\local\php5\ext\
php_mongo.dll from this site: and put it in a folder Through trial and error, it was found that a suitable driver is contained in the archive

B. mongo-1.2.5.zip/mongo-1.2.5-php5.3vc9ts.zip php.ini
. If for some reason it doesn’t start for you, try other versions.

connect the extension to

extension=php_mongo.dll 6.2 Installing Mongo A. download the archive from Mongo and unpack it into a folder

B.\usr\local\mongodb
. In the same folder we create two more folders:
install the service

> cd C:\WebServers\usr\local\mongodb\bin\

A.> mongod.exe --install --dbpath=C:\WebServers\usr\local\mongodb\db\ --logpath=C:\WebServers\usr\local\mongodb\logs\ 6.3 Setting up MongoDB to launch in conjunction with Denver create a file with the name \denwer\scripts\init.d\
"mongod.pl"

B. in the directory
#!perl -w package Starters::mongoDB; BEGIN ( unshift @INC, "../lib"; ) use StartManager; StartManager::action $ARGV, start => sub ( ### ### START. ### print "Starting mongoDB\n"; system("net start mongoDB"); print " Started!\n"; ), stop => sub ( ### ### STOP. ### print "Stopping mongoDB\n"; system("net stop mongoDB"); print " Stopped!\n"; ); return 1 if caller;
and save the file under the name write in a text editor init.d/mongod

  • \denwer\scripts\main\start
  • \denwer\scripts\main\stop
  • \denwer\scripts\main\restart

"60_mongod"

to folders already familiar to us:
6.4 Checking the result

Let's launch the mongo console interface
> Z:\usr\local\mongodb\bin\mongo.exe
And we will insert and output the test value into the “test” database

> db.test.save(( name: “Habr!” ))

> db.test.find()

There is a list and short reviews of admin panels on the MongoDB website, so you can choose according to your taste.
I chose RockMongo for myself, so with its help we will finally make sure that everything works for us and does not crash anywhere.

A. download the archive with the admin panel from this page. Naturally, we choose Windows version. At the time of writing this article RockMongo-on-Windows v0.0.4

B. take a folder from the archive \rockmongo-on-windows\web\rockmongo and copy it to the directory of our test site
Opening config.php and change the value of the parameter
$MONGO["servers"][$i]["control_auth"] = true;
on
$MONGO["servers"][$i]["control_auth"] = false;

C. Check the result using the link www.test.local/rockmongo/index.php

Congratulations! Now we are completely and irrevocably well done.

Bonus #1. Working with php from the Windows console

Perhaps it will be useful to someone. It came in handy for me when our evil tech lead decided that “SQL files are a thing of the past, let’s use migrations.” Of course, for the sake of decency, I tried to feign complete misunderstanding and even shed a tear, but I was exposed and sent to figure out how it works on Windows.
It turned out that all you need for happiness is add PHP directory to PATH.


Click on “Edit” and add to the end of the line
;Z:\usr\local\php5

Now let's check that everything worked.
Let's create a file in the directory of the test site console.php

Open the console(you can directly from the same folder - right-click with SHIFT pressed on an empty space and select “Open command window”).
Enter:
> php console.php “UserName”

The console responds:
> “Hello, UserName!”

PHP is defeated, general rejoicing, applause, curtain.

Bonus #2.

All files and examples mentioned in the article in one archive for free without SMS: on Github

I hope that this material will be useful.
I would be grateful for comments and suggestions.

Tags:

  • denwer
  • local server
Add tags

Local server - This is a special program that is installed on a local (read home, that’s why it’s called LOCAL) computer that allows web developers (webmasters) to develop websites on a local (home) computer, without the need to access the Internet. This is not even one program, but a complex of programs that perform various functions. A local server is similar to a real real server located on the Internet by the Hoster company.

What is it for? As you already know, regular HTML pages with CSS design are processed by browsers without problems. Those. If your site is created from simple web pages built on HTML and CSS, then such a site can be perfectly developed on a local computer without any servers. Just click on the html file as usual with the left mouse button and the web page opens in the browser. You have worked with the code, design, added or removed something, save, update (F5) and see the result.

But if you are developing a dynamic website created using, for example, PHP, Perl, MySQL databases, some ready-made scripts, That To test and debug such sites, you definitely need to install a local server on your computer.

For what? The fact is that such sites (web pages of sites) before being sent to the visitor in the browser, pre-processed by the server, and only then in the form of regular HTML code are given to the browser. This happens very quickly on the server side, i.e. on the Internet and visitors do not even notice such pre-processing.

For example, sites made using PHP are assembled as if from separate pieces, separate files. Let's look at a simplified diagram of such a site. As a rule, any such site (any web page) contains several main components:

    Site header;

    Site footer;

    Menu;

    Main page content (content).

When creating a website in PHP, each such piece is a separate file with the extension .php

A simplified site diagram in PHP, presented at Figure 1 below:

Figure 1. Simplified site diagram in PHP.

Of course, this is not a complete list of components (pieces); sometimes there are a lot of such pieces (files). But the operating principle is always the same. On the server, a web page is assembled from separate files (in this case it is header.php, footer.php, menu.php, content.php) and already the site visitor is given the finished result in the form of html code. You have already noticed that all files here have the extension .php

What is PHP?

PHP is a programming language specifically designed for writing web applications (scripts) that run on a Web server.

The acronym PHP stands for “Hypertext Preprocessor”. The language's syntax comes from C, Java, and Perl. PHP is quite easy to learn. The advantage of PHP is that it allows web developers to quickly create dynamically generated web pages. My website was created using PHP language.

So, if you want to view the code of such a PHP page (right button, view HTML code), then you will not notice the difference with a regular web page created in HTML. But know that all web pages with the .php extension work this way (they are assembled piece by piece from separate files).

In addition, PHP has another great feature: the PHP code script can be easily integrated into any HTML code.

On the local computer, to “assemble” and process PHP files, a local server is installed, which in this case acts as a processor.

Currently, most of the dynamic web pages: forums, blogs, guest books, most feedback forms, and just PHP scripts, will work on a home computer only if there is a local server.

In my practice, I use a local server called Denver (denwer). You can download and view detailed installation instructions on the official website http://www.denwer.ru/. Or on our website in the section.

With us you can do it for free. What is Zend Optimizer?

Zend Optimizer is a special utility that is used to encode and optimize scripts (PHP programs) encrypted using Zend Guard (scripts are encrypted in order to protect the program code from plagiarism and unauthorized use). This utility allows you to optimize your code for even faster execution of scripts (PHP applications) and increases site loading speed by 40%.

To put it in “simple” language, then Without the Zend Optimizer utility installed on your computer near Denver, many scripts simply will not work, since most developers protect their software products (scripts, programs, etc.) from unauthorized intervention and theft.

Zend Optimizer is installed after installing Denver to your home computer by simply replacing the folders: denwer, home, tmp and usr, which come with this assembly.

Local server "Denver" is the original project of Russian programmer Dmitry Koterov. Therefore, everything here is in Russian, there are very detailed instructions and recommendations. Moreover, everything is absolutely free. There are educational video lessons. More Denver is called - Gentleman's Web Developer Kit.

If you plan to create dynamic websites, download, install and use.

Read also our other materials.