Hello Stack Overflowers,
I am a newbie to servers (and Linux in general). I have recently made an HTTP server on Kali Linux (formerly BACKTRACK). When I type in http://localhost/ it works and my HTML page shows up. BUT I want to change the URL to be https://localhost/ The server software that I am using is Apache.
Thank you for your help in advance.
Thomas
https://localhost means, that your Computer does not fetch the site from the internet. You can test this by trying to view your site while offline - this will work.
If you want another domain name, you have to put your site on the internet.
Find a hosting provider, make a contract, choose a name for your site that's not already taken, load up your page.
Be aware that this might cost something.
If you want to change the name only locally, open the file /etc/hosts
as superuser.
It should look like
# Comments Here
127.0.0.1 localhost
# End of /etc/hosts
Add
# Comments Here
127.0.0.1 localhost yourdomain.name
# End of /etc/hosts
Note that your site then can only be viewed on your computer.
Related
I installed ubuntu server 16.10 on VirtualBox recently in order to host a website on it thanks to apache2.
I followed some tutorials to do it, but here's the issue : it doesn't work :/
I mean, when I use ifconfig, I get the following IP : 10.41.175.36
If I type this IP in the URL, I get the default html page for apache. So this is good, I guess, I'm able to access this webpage from any devices if they're connected to the same wifi.
Now I want to create 2 websites on my ubuntu server, I created one index.html in /var/www/site1 and one in /var/www/site2, I configured the .conf in /etc/apache2/sites-available for the 2 websites, I restard the apache2 and enabled the websites.
Now, I tried to enter the domain name I gave them but It tells me that the URL isn't known.
I edited the /etc/hosts to change domain name and it doesn't work.
So do you have a tip or a tutorial in order to create the websites ?
I hope I was clear, thank you.
You should check out VirtualHosts on Apache2. https://httpd.apache.org/docs/2.4/vhosts/examples.html
Sorry if this question is stupid, but I am a newbie when it comes to apache and servers in general and I have been trying but I can only find windows only answers. I'm running an apache server on a mint vm. When I type localhost, it redirects to the page automatically, same as doing 127.0.0.1 or 127.0.1.1. Now, I want to change this to another domain name, but not a website one. Like, I want to change from the word localhost to another word, like 'local'. I have been unable to find answers, I have read about virtual hosts but I don't think that is it because I'm only running one website instance. This is just an example website btw, it's just a index.html file for me to learn how to configure things. I have changed my 000-default.conf to say ServerName thenameIwant but it doesn't work. I noticed it says that this is the last resort host what is the first one?
To be able to use local to connect to your server, you would use local as a domainname which resolves to localhost or 127.0.0.1. You could do this by editing your hosts file. Depending on your os this file is stored in different places. Just google 'Change hosts file [your os]'. And add the following line: local 127.0.0.1.
The default apache server is set to listen for any domain, also local.
I want to set up a machine for testing a website before launching it. Some of the tests require logic in parsing the current host.
I want to be able to test it in my browser but i can only access it through the localhost.
I want to know how to make my browser resolve my domain to 127.0.0.1:80. (Also I don't want my DNS record to point to my test machine, this should be a local test only).
Also, is there a way to make all sub-domains of my domain access 127.0.0.1:80 as well?
Extra Info --
OS: Windows 7
Browser: Chrome
Web Server: Tomcat 7
Thank You.
EDIT ---
The solution was to add a few lines to the host file:
127.0.0.1 example.com
etc.
You're looking for the hosts file. It's more than likely what points localhost to 127.0.0.1 on your computer.
You can find it at C:\Windows\System32\drivers\etc\hosts on Windows. Or /etc/hosts on most Linux systems, if you're interested.
We have a win2003 server that run both IIS 7 and apache (using wamp server 2.2).
We put on both server a page named test.html that show us a message that say "You are on IIS page" and "You are on WAMP page" to show us if everything is working correctly.
Both running real great locally. IIS is listening on port 80 and apache on port 8082. The problems come remotly. Both services are running and wamp is fully online (green icon + "put online" option activate).
Locally, on the server, doing http://localhost/test.html and http://localhost:8082/test.html show the correct pages. If we replace localhost by real IP address (for example purpose, let say http://10.2.5.16/test.html and http://10.2.5.16:8082/test.html), still work. (not actual address but address used for real is the same used by dns web service)
Remotly, from any other PC, doing http://10.2.5.16/test.html and http://10.2.5.16:8082/test.html, the first give us the website normally, the second give us a HTTP 403 FORBIDEN (tried using both htaccess and windows permission, still have 403). The same way, using http://www.ourdomain.com/test.html and http://www.ourdomain.com:8082/test.html give us the exact same result (first ok, second 403)
Is it possible to make it work correctly?
Thanks in advance.
edit: Just to add to the solution :
the firewall was blocking me, add the wamp on this port allowed
in my configuration, i had in my directory statement Require local, which needed to be set to Require all granted
for the rest, the solution was pretty it.
Thanks again.
The fact that you can get to the sites locally tells me both servers are setup correctly and listening on respective ports.
Upon further questions, the OP indicated that the Servername Directive, is pointing to localhost and it should be changed as.
ServerName localhost:8082
To
ServerName example.com:8082 # or add "ServerAlias example.com:8082" to your existing.
Where as example.com is your site DNS. Then in your [System32\drivers\etc\hosts] point that DNS to the ip of your Remote host.
403 is happening because the request from the remote is not matched against any Servername or ServerAlias and it falls to the default handler which normally has stricket permissions. If you look closely in logs(/logs/apache/access.log), there should be something about "access denied by server configuration /somelocation like your default DocRoot"
If you make request for http://example.com and you have correct ip in your hostfile, you can trace what happens to that request in the remote host and where it ends up(firewalls, Apache etc). Apache is good at logging and you just need to find relevant log entries!
Ok, I have a local site called located here: http://localhost/mysite/
I want to be able to type http://www.mysite.com and for that to pose as the above mentioned.
I am using Windows Server 2008 / IIS 7.
Any ideas?
Not an expert but this looks helpful: Redirect URL to localhost
would an entry to /etc/hosts pointing that name to 127.0.0.1 not
suffice? you wouldn't be able to route to that hostname, but i guess
that's imaterial really. you could also use a browser plugin for
developers which allows you to specify arbitrary headers, i.e. in
firefox you could go to http://127.0.0.1 but include a HOST header for
the clients domain name which apache would then act upon. i expect a
/etc/hosts is probably all you really want.