📜 ⬆️ ⬇️

All webmord in one. virtualhost and proxy_pass in nginx for home.

In this article I would like to share my experience on how to organize access to the web interfaces of various home rocking chairs through a single port that was thrown out. We will do it under Windows (on the Win32 port of nginx), but you can also do it under unix.

Where it may be needed? A very simple example consisting of two conditions:
- I have a STREAM at my home, which blocks the incoming port 80
- Only ports 443, 80, 5190 are open to work at my place.
- As a result: I can only get home to 2 services, one of which I have is SSH, and one remains free. The task is to wrap up all the WEB snouts in one site, because I was tortured with SSH tunneling. The universal interface, of course, will not work, so they need to be logically separated.

I will not say anything revolutionary, I will just tell you how to do it. The whole story is based on the following things, but if you want, you can easily connect any other web interface:
- Do you have a dynamic real IP
- DynDNS
- nginx for Win32
- µTorrent
- µTorrent WebUI
- eMule

DynDNS - principle, registration and setup

The principle of operation of DynDNS is very simple: a program on a computer, router or modem periodically calls on the DynDNS service. The service looks at the IP from which the call occurred, and binds the free DNS record you registered to the IP from which the call came. Thus, an address of the form myname.dyndns.org always indicates exactly your external IP address, even if you have it dynamic.
')
You need to register an account on the DynDNS website , then create one free DNS record in the second-level domain that you like best. I, for example, like .homedns.org. In the settings you should check the box “Create wildcard alias”. Record type must be “Host with IP address”. An example can look at the picture:

Now we need to configure the client program. Immediately, I’ll make a reservation that many Asus WL * routers already have a built-in DynDNS client, its settings are less IP Config -> Miscellaneous . Also in many other home routers and modems there is a DynDNS client. If not, then it will need to be put on our server. You can download it on the DynDNS site itself in the appropriate section .

We include, enter your login, password, and already registered on DynDNS.org DNS name that we want to use, and voila, now you can contact your home router using a DNS name, for example, vpedalkin.dyndns.org.

uTorrent, eMule, ...

I propose to customize the WEB-interfaces of all the programs that you need yourself, thankfully, there are a lot of instructions on this topic.

WebUI uTorrent we should configure on an alternate port and configure filtering by IP. Since we will install the nginx server on the same machine as uTorrent, we filter by 127.0.0.1 (i.e., only from this machine). We use the alternative port so that our Web-muzzle does not stick out in duplicate - via nginx and through the port thrown to uTorrent.
A hint for those who have never set up uTorrent WebUI: You must put the webui.zip file downloaded from the uTorrent site into the profile folder without unpacking. To open it, click Win + R and enter% USERPROFILE% (with percentages) and click OK.

WebMoney eMule is easy to set up easy: write the port, password and that's it.

I used port 8081 for uTorrent and 8082 for eMule.

Go to nginx configuration

To my great regret, nginx under Win32 is officially not, but there is a third-party build on cygwin. Of the main drawbacks, it can be noted that nginx win32 is installed only in C: \ nginx and can’t get him out of there.

So, install nginx, open C: \ nginx \ conf \ nginx.conf. I Prefer to use the AkelPad editor - it is very similar to a notebook, but is good at making friends with encodings and small ryushechkami.

In my case, the HTTP server hangs on port 5190, because it was a pity to occupy 443, and it was inconvenient for me to configure a secular server, since uRemote, which I use, does not support HTTPS connections.
The complete example of my config is here .
In general, we add Server directives, like this:
server {
listen 5190;
server_name emule.vpedalkin.xxxxdns.org;
access_log logs/emule.log main;
location / {
# URL
proxy_pass h ttp://127.0.0.1:8082/;
proxy_buffer_size 8k;
proxy_buffering off;
proxy_connect_timeout 3;
proxy_ignore_client_abort off;
}
}


I draw your imagination: for sharing we use Virtual Hosts. Thus, the server, depending on how it is accessed (as utorrent.vpedalkin.dyndns.org or emule.vpedalkin.dyndns.org), performs transport to a specific server (to uTorrent or eMule, respectively).
Do not forget to fix in the config all listen to the port that you are going to open outside for the web server. Also replace all vpedalkin.xxxdns.org with your own details registered in DynDNS. I note that emule.vpedslkin.dyndns.org does not need to be registered additionally - thanks to the checkmark that we set in the recording properties on the DynDNS.org website at the very beginning, all this will be transferred to the same place as vpedalkin.dyndns.org itself
Forwarding

Now the main thing is not to forget to forward the port to the wind machine on the router. I am using port 5190 for the web server.
Result

As a result, I received a web interface to eMule at https: //emule.vpedalkin.xxxdns.org: 5190 , I have a quietly configured and working uRemote on the utorrent.vpedalkin.xxxdns.org port 5190 , and also a web-muzzle uTorrent at https: //utorrent.vpedalkin.xxxdns.org: 5190 / gui . It would be possible to remove this prefix / gui / , but in many programs such as uRemote this line is sewn up, and having got rid of it we will not be able to make friends with the program and the webmord.
Additionally, we have a website : http://vpedalkin.homedns.org: 5190 , where I have a set of links to all my web snouts (I have a little more than described). Files of this site are in the folder c: \ nginx \ html.

I was glad if someone would find this information interesting.

Source: https://habr.com/ru/post/50130/


All Articles