127.0.0.1 example.com www.example.com
It is work for example.com but don't work for
www.example.com .
How to do setting for this problem that work all address Even for sites available on the Internet?
Related
It is possible in SpringBoot to map localhost into example.com like in Laravel, like below?
How to change localhost url for Laravel
Adding the following:
127.0.0.1 example.com
to your C:\Windows\System32\drivers\etc\hosts file should suffice.
Add this to your hosts file
127.0.0.1 example.com
Or if you are using linux you can set this as your hostname
example.com
I have a website published on AWS and I used Lets Encrypt for its SSL certificate. In my apache configuration I added the domain as:
ServerAlias example.com *.example.com
On AWS route 53 I added a CNAME and redirected the www.example.com to example.com.
The issue is that website is secure when I do example.com but not with www.example.com
I'm using MAMP on windows 10 and I couldn't start Apache server because of my default port(80) is used by System. So I changed the default port to 8080. But now I can't access my previously set up virtual host sites. Please help me
I already tried this :
1) MAMP\bin\apache\conf\httpd.conf
Listen 8080
2) MAMP\bin\apache\conf\extra\httpd-ssl.conf
<VirtualHost _default_:8080>
Listen 8080
3)hosts file
127.0.0.1:8080 mygym.test
4) MAMP\bin\apache\conf\extra\httpd-vhosts.conf
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "E:/MAMP/htdocs/mygym/system"
ServerName mygym.test
</VirtualHost>
now when I typed as mygym.test in the URL tab It comes a 404 error
No webpage was found for the web address: http://mygym.test/
You are doing it wrong.
3)hosts file
127.0.0.1:8080 mygym.test
The hosts file is for host name resolution only. You cannot put port numbers in there. the browser is what selects the port to choose.
Instead try 127.0.0.1 mygym.test in hosts file and try http://mygym.test:8080 in browser.
I am running Virtual Machine with Laravel project.
Typing 192.168.10.10 in browser re-directs correctly onto Laravel home page.
Typing testing.test is googling 'testing.test'. Tried across IE/Edge, Opera, Chrome.
My Homestead.yaml config is:
sites:
- map: testing.test
to: /home/vagrant/Code/Laravel/public
My hosts file is:
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
192.168.10.10 testing.test
Interestingly - if I add
127.0.0.1 www.stackoverflow.com
Stackoverflow will get 'blocked'.
Also pinging testing.test from commander gives positive response from 192.168.10.10.
Tried flashing DNS, turning off IPv6. Please help :)
Adding http:// in front of testing.test in hosts file helped. Also cleared dns from chrome and opera.
So the hosts file looks now:
192.168.10.10 http://testing.test www.testing.test testing.test
I am trying to call my xampp localhost from another computer's browser, I have changed host file at C:\Windows\System32\Drivers\etc by appending (192.168.1.105 localhost) at the end this file and save it and then restart computer, but I could not call my localhost from another computer.
Thanks
You need to access port forwarding in your router and forward port 80 only as TCP. Also, the host file code should look something like YOUR IP YOUR IP and not YOUR IP localhost. Furthermore, you need to edit httpd-vhosts.conf from apache folder in xampp instalation with something like that
<VirtualHost *:80>
ServerAdmin whatever#whatever.com
DocumentRoot "PATH TO YOUR FOLDER"
ServerName YOUR IP
ServerAlias YOUR IP
</VirtualHost>
After that you must restart apache in XAMPP control panel (MySQL not necessary)
THE SOLUTION ABOVE WILL LET YOU SEE YOUR CONTENT FROM ANYWHERE AS LONG AS YOUR LOCAL PC IS TURNED ON AND HAVE INTERNET CONNECTION. THE SOLUTION BELOW (I DIDN'T TEST IT, BUT I GUESS IT WILL WORK) WILL LET YOU ACCESS YOUR CONTENT FROM LOCAL NETWORK ONLY.
edit your httpd-xampp.conf file as following and after that you should probably need to perform a browser cache cleaning
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
#Deny from all
#Allow from 127.0.0.0/8
Allow from all
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>
When you add 192.168.1.105 localhost on the other PC (the one you want to use to view your website), it will look for a website on the same machine. Delete the entry from the hosts file and enter the IP address in your browser and it should work if the webserver is running.