Webmin local development with name based virtualhosts - linux

Hi i am trying to name based virtual hosts for my localhost.I was using wamp with name based virtualhost before but now im working on ubuntu.I thought webmin can be easy but when i create first virtual host all requests redirecting first virtual host even localhost,second virtualhost and phpmyadmin.
So how can i set webmin for reach each of them separately.
hosts config
127.0.0.1 www.adres1.com #working fine
127.0.0.1 adres1.com #working fine
127.0.0.1 www.adres2.com
127.0.0.1 adres2.com

Its because you are using a local server and your all domain will by default search 127.0.0.1 or your IP. So untill you declair them as CNAME in your zone file or do a entry in host file, they all will work as alias of a single domain. Thanks... :)

Related

Website works remotely but not on the server itself when called by domain

I am using Windows Server 2019 and in IIS 10 I have created a website and I have bound it to both: "localhost" and "mydomain.com" on port 80.
mydomain.com works correctly from any client but on the server only when I call "localhost" it works otherwise I get the following error (when called by domain):
Configure your DNS in your local server to resolve the domain name as localhost
On clients, your request domain.com is resolved by its configured DNS.
It can be on public DNS (internet) or private ones (company, intranet).
From the server domain.com, do you have access to the same DNS than your clients use ?
If not, either configure additional DNS servers :
https://serverspace.io/support/help/configuring-a-dns-server-on-windows-server-2012-or-later/
or you could edit you Host file of mydomain.com (local DNS):
C:\Windows\System32\drivers\etc\hosts
It may look like that :
127.0.0.1 localhost
127.0.1.1 mydomain.com
# and existing settings

cPanel Server Incorrect URL Resolve

My cPanel server is resolving a URL wrong. The website example.com is hosted on my cPanel server at ip 1.0.0.1. In a script I am attempting a cURL command to cp.example.com which is hosted on another server at 2.0.0.2. My server is resolving cp.example.com to the IP of 1.0.0.1. Any help will be greatly appreciated!
It seems like your dns settings for cp.example.com are not visible on the host where you are running your script. You should check the dns settings for cp.example.com. You may also want to contact the Cpanel support
When you make a cURL request from a source hosted on your cPanel server the IP for the domain is first resolved locally, if it's not found in your Server's DNS zones it will be resolved from your configuration at /etc/resolv.conf
You can test to see which IP your server is resolving this by logging via SSH and pinging it
Executed from your cPanel Server
ping cp.example.com
I can think of two workarounds for this issue:
If example.com's DNS zone is hosted in your cPanel account
Go to cPanel -> Zone Editor
Open the DNS zone for example.com
Find the A record for cp.example.com
Change it to 2.0.0.2
If you have root - edit your WHM / cPanel Server's /etc/hosts file
root#server #: vim /etc/hosts
// 2.0.0.2 cp.example.com

Access two sites hosted on my IIS server with the same port?

I currently have two websites hosted on my IIS 7 server. Each website has its own host name but shares the same port (80).
Everything works great locally to access the two sites:
Site #1: http://localhost/ -> http://arcadiastudio.ch
Site #2: http://webService.ch/
But from the outside I cannot reach my second website hosted on the same port. I do not know what to put in the URL:
Site #2: http://arcadiastudio.ch/??
Here is what I have in my host file:
127.0.0.1 localhost
127.0.0.1 webService.ch
::1 localhost
This should be very simple. All you need to do is to have each hostname specified in your hosts file. In your case, your host file on your local PC should look like:
127.0.0.1 localhost
127.0.0.1 webService.ch
::1 localhost
127.0.0.1 arcadiastudio.ch
And the hosts file on your remote PC should look like:
127.0.0.1 localhost
<remote_ip> webService.ch
::1 localhost
<remote_ip> arcadiastudio.ch
Obviously, you need to change <remote_ip> to the IP address of your web-server.
Also, if you want to allow any remote PC to connect, you will need to register your domain names for DNS - you can't edit every host file in the world!!

Assigning a domain name to localhost for development environment

I am building a website and would not like to reconfigure the website from pointing to http://127.0.0.1 to http://www.example.com. Furthermore, the certificate that I am using is of course made with the proper domain name of www.example.com but my test environment makes calls to 127.0.0.1 which makes the security not work properly.
What I currently want to do is configure my development environment to assign the domain name www.example.com to 127.0.0.1 so that all http://www.example.com/xyz is routed to http://127.0.0.1:8000/xyz and https://www.example.com/xyz is routed to https://127.0.0.1:8080/xyz.
I am not using Apache. I am currently using node.js as my web server and my development environment is in Mac OS X Lion.
If you edit your etc/hosts file you can assign an arbitrary host name to be set to 127.0.0.1.
Open up /etc/hosts in your favorite text editor and add this line:
127.0.0.1 www.example.com
Unsure of how to avoid specifying the port in the HTTP requests you make to example.com, but if you must avoid specifying that at the request level, you could run nodejs as root to make it listen on port 80.
Edit: After editing /etc/hosts, you may already have the DNS request for that domain cached. You can clear the cached entry by running this on the command line.
dscacheutil -flushcache

Service httpd error

I have a centOS virtual machine with 3 virtual hosts. It worked fine until this moment when I lost access to the dns server. Now the hosts can't be resolved. Can any1 tell me if I can configure some static routes or something to the virtual hosts?
Print screen with the httpd response:
P.S. I would prefere not to configure a DNS server since the old one will start tomorrow again.
In your /etc/hosts you can map IP addresses to hostnames:
127.0.0.1 example.com
127.0.0.1 example.net
// etc...

Resources