lighttpd subdomain without "domain" - subdomain

Referring to this question here: Adding subdomain support into lighttpd
I am trying to setup a subdomain on my server. The example provided in the link above works but, the problem is, I still have not bought a domain and, as I am running on a development environment and my IP is dynamic, I have problems in setting it as I need to change the config file every time I change my IP.
Is there any way to set a subdomain without necessarily setting the domain as well?
This question is a good fit for all the people who are running in a development environment with dynamic IP, and need to setup subdomains for their website.

Why don't you force the dns (on your local machine) by editing your /etc/hosts file ?
#[server ip] [new domain not bought]
90.90.90.90 subdomain.domain.com
Then, every time you will go on subdomain.domain.com, it will point to 90.90.90.90, which is your server.

Related

Wordpress host with raspberry pi - images don't load when accessing it from outside the network

I'm trying to make my first basic web server to host a wordpress website using a Raspberry pi 3, nginx, php7.0, mysql and phpmyadmin.
I have set everything all right, I can access the wordpress site and edit it when I'm connected to my router, but once I try to access it from outside using my phone network, it loads but it shows no images and the website looks totally disorganized.
I'm using no-ip to get a static IP, I have set the router DMZ on the Pi and it's connected through WiFi, so there should be no firewall between the Pi and my phone.
I really don't get why this is happening, it looks like something is blocking some parts of the info exchange, could this be my ISP and the solution would be to change the website port from 80 to another one? I'm starting to discard this option because when I access from outside to the phpmyadmin management site, it loads correctly, including all images.
As I said this is my first experience and I don't know what else to look, I would really appreciate help from more experienced users.
WordPress uses two configuration variables to determine the address of the site and the address of resources for the site. See changing the site URL for details.
You currently have these values set to an internal address that cannot be resolved to your static IP.
If you set the values to your external address (used by your phone network to access the website), the external access should begin to work, e.g. http://example.ddns.net/. However, a negative side-effect is that internal access may stop working!
You should be able to make both internal and external access work, by removing the scheme and hostname from the values, and setting only the path component, e.g. /.

Local debugging of subdomains with VS 2015

I have a multi-tenant website that has to take care of any incoming request and determine the appropriate routing by the URL subdomain.
I set up the subdomain routing using this or a similar solution.
However I'm trying to access my website on my local machine using subdomains an alias website. I'm unable to get my local IIS to port to my website with the subdomain I've specified.
I want to dedicate a virtual domain name in my local machine that will port to the website I'm debugging on VS (localhost:23456).
I've read some answers of identical questions (like this or this one), but it looks like the system has changed with the new IIS and Visual Studio 2015 and ASP.NET 5 MVC 6 (vNext) project configuration.
Here's what I've tried according to the answers linked above:
I tried setting the hosts file porting www.myexample.com to 127.0.0.1 but I get a "Bad request" error when navigating to www.myexample.com:23456 in my browser, and anyway the debugger doesn't report a request.
I tried setting <binding protocol="http" bindingInformation=":23456:www.myexample.com" /> in the applicationhost.config file, gets IIS to raise an error saying "Replace hostname with localhost. Any other bindingInformation not specificying localhost as the website raises that IIS error.
Update
After opiants answer
I knew about the .vs folder and that's were I was configuring the bindings indeed.
However, looks like it was the permission that caused IIS to throw errors.
Running that netsh command solved the issue. And BTW, since I'm only running it my own machine, I'm not gonna need to open the firewall.
Anyway my question is if there is a way to add a wildcard instead of each subdomain separately? Since each tenant gets a unique subdomain, the whole process of adding subdomains is going to be dynamic by nature. I need to allow an asterisk in all the 3 places:
hosts file
applicationhost.config file
netsh command
It looks like I can add the asterisk in those places but it doesn't actually work.
I'm guessing you're using IIS express locally?
If so, in your solution directory, there is a .vs folder. You need to add the binding in the \config\applicationhost.config file inside that folder. Then make sure that you've allowed IIS express to listen to that subdomain.
You can refer to Scott's article on how to configure IIS Express. Specifically look for this paragraph "1. GETTING IIS EXPRESS TO SERVE EXTERNALLY OVER PORT 80"
To be more specific, you need to run these commands:
netsh http add urlacl url=http://{your-domain}:{custom-port}/ user=everyone
netsh firewall add portopening TCP {custom-port} IISExpressWeb enable ALL

Accessing WP admin of a multisite with expired domain

I got a multisite network, and got subsites on it, unfortunately the main domain has expired, and I cannot access my WP admin. I don't worry about the main site but I need to have the subsite.
I am able to access the main site using the IP but not its WP admin. I tried following this but it didn't help. I saw a way via accessing database (this method) but I couldn't access database as its hosted in Digital Ocean, it's pretty hard without a control panel.
want a way to access main sites WP admin
access my subsite via URL (it has a separate domain which is being masked)
If your domain has expired, ordinary DNS will not work. This means that domain-based hosting on the web server will no longer operate as well.
However, you can easily trick your local machine into thinking the domain still exists. This will work on Linux and OS X. You'll need to know the IP address of your web server - if you do not have this, you'll have this in the welcome emails you've received from your web host, or perhaps by logging onto your customer control panel.
Edit your /etc/hosts/ file. In a blank link at the end, add this:
yourdomain.tld 1.2.3.4
where 1.2.3.4 is your IPv4 address. The gap between the two can be any number of spaces or tabs.
Once this file is saved, you should be able to ping it thus, in a console or terminal utility:
ping yourdomain.tld
and it will show you what IP address you have assigned it to.
You can then access it normally. Bear in mind, though, that only you have the DNS information, so it will not work on any other machine. It will however allow you to access your WordPress control panel.

Access HTML page on local network

Say I have this HTML page , I want when some one on my local network type my(ip) or my computer Name in a browser to view that HTML page
You just have to edit the httpd configuration file and ensure that the default port is set to 80, as by default it should use that anyhow, 8080 is the alternate one.
If you use a local network then the rest of the users in it should be able to reach the website on http://your-computer-name, otherwise if for any other reasons that's not configured then they'll have to use the IP address.
They can also edit their local hosts file (in Windows for eg.) and have something like:
your.IP any-name
any-name being either your computer name or website name, as it will be a direct maping

Set chrome to ignore hosts file

How can I set chrome to ignore hosts file?
Here is the scenarion:
I have www.example.com site which is Live and customers are using it and now I have got the code hosted on a new server with a host file entry to that server for my domain I am able to browse to the new server. Problem is everytime I want to check whats on live I have to edit my host file entry. So is there an option to manually set one of my browsers ex: Chrome to ignore the host file entry?
HostAdminApp, a Chrome extension, does exactly what you need.
No, I don't think you can, since the hosts file is an operating system wide setting. It would be easier and better to manage if you change the domain of the test server to www.example.local, so www.example.com will go to the live server.
Edit: Another simple solution would be to use a browser in a virtual machine. It could be worth the effort if you need to do a full testing
As it turns out you may be able to use an issue with Chrome to accomplish this. I was having trouble getting Chrome to recognize/use my /etc/hosts file to locate locally defined IPs. It was always doing a search on the name rahter than going to the locally defined domain.
I had to comment out these 2 lines to get it to work:
::1 localhost
fe80::1%lo0 localhost
So, I am guessing that if you put them in, Chrome will ignore your hosts file. It seems it is an issue the Chrome has with IPv6, so as long as you only need IPv4 for the things in your hosts file you may be able to use this Chrome bug to accomplish what you want. At least until it gets fixed...
There is no straight forward solution. The sort of temporary solution is Browser loads host file only when its loaded so I ended up editing the hostfile entry open the browser instance and changed the host file entry back.
So that way the new browser opened will have a new host file entry loaded.
Well, not a solution to the actual problem (force the browser to ignore hosts file), but rather a flexible alternative.
Ok, so what you usually do in your site's configuration is to have a server alias for www.example.com and example.com. So, then you probably enter in your host file something like this 123.231.123.231 example.com where that IP is your new server's IP and you access your site via example.com. Right ?
Well, here's the catch, if you type www.example.com in your browser instead of example.com you will still see the old site, even if you have set alias with www in your new server's configuration. I think you can apply the same trick with http and https, but you get the idea.
Hope this helps.