I have created virtual hosts by going to C:\xampp\apache\conf\extra\httpd-vhosts.conf
then i wrote this:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/basicwebsite/public"
ServerName basicwebsite.dev
</VirtualHost>
and then i went to hosts file in C:\Windows\System32\drivers\etc and wrote this:
127.0.0.1 localhost
127.0.0.1 basicwebsite.dev
then I stopped the apache server and again start it, normally it should have open the laravel application that we are making but when i open browser and typed basicwebsite.dev it showed an error in my browser it shows this
Screenshot of my page when i type the link
it says this site cant provide secure connection.
but it shouldn't have shown this , it should have shown the page.
What to do here?
Laragon provides this feature very well. It is easy to setup virtual host with it beacuse it provides Pretty URLs using
Auto Virutal Hosts
Learn more about laragon here
.dev is blocking by browser. Instead of that use .loc or something else
Related
I successfully created an Apache Virtual Host on my dedi for Subdomains, which works good. The only problem is, that Wordpress creates sub-pages like this: name.tld/page/
How can I say apache that this is an under page from wordpress instead of sub-folder, because http://flamespersecond.de/home/ works but any under page from this wordpress page doesn't works?
"Not Found
The requested URL /home/neuigkeiten/ was not found on this server."
My Virtual Host file looks like this:
NameVirtualHost IP:80
<VirtualHost IP:80>
ServerAdmin EMAIL
DocumentRoot /var/www/html/flamespersecond
ServerName flamespersecond.de/
ServerAlias flamespersecond.de/
ErrorLog /home/vweb1/log/flamespersecond-error.log
CustomLog /home/vweb1/log/flamespersecond-access.log common
</VirtualHost>
I have switched the host, now is everything fine! Thanks anyway.
Yesterday i have created a new site on my Codero Dedicated Server. and i have not assigned any domain name yet to the ip address.
Currently i am able to access my site with http://MySiteIpAddress/~username but i want to access it with only http://MySiteIpAddress/. Is there any way to do it. I don't know if that's possible by htaccess rules, so any hints are appreciated.
You want to setup a virtual host and point it to the folder you want.
See this other post for more details.
You need to do several steps in order to make this work.
1.) Update the hosts file. On Windows XP, you can find it under c:\WINDOWS\system32\drivers\etc\. You should already see the first
line from below, it takes care of your mentioned other project. - add
the additional ones to make any requests to the mentioned virtual
hosts routed back to your own machine.
127.0.0.1 localhost
127.0.0.1 foo-bar.com
127.0.0.1 abcdef.com
127.0.0.1 qwerty.com
2.) Update the vhosts file in Apache configuration. Under your XAMPP folder, add the following to
apache\conf\extra\httpd-vhosts.conf and if needed change the ports
(i.e. if you use 8080 instead of port 80).
<VirtualHost *:80>
DocumentRoot C:/xampplite/htdocs/foo-bar/
ServerName www.foo-bar.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:/xampplite/htdocs/abcdef/
ServerName www.abcdef.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:/xampplite/htdocs/qwerty/web/
ServerName www.qwerty.com
</VirtualHost>
3.) Do a quick configuration check. Open {XAMPP-folder}\apache\conf\httpd.conf your file and make sure that
the following part is not commented out by a preceeding # character:
Include conf/extra/httpd-vhosts.conf
4.) Restart XAMPP.
... and you should be all setup now. Your other project should
be accessible at the URI you mentioned if you just put it under
C:/xampplite/htdocs/my-project/.
I am running WAMP and using CodeIgniter for my project and have this on my vhost:
<VirtualHost *:80>
ServerAdmin admin#yahoo.com
DocumentRoot "C:/wamp/www/myproject/assets"
ServerName myproject.dev
ErrorLog "logs/myproject.dev-error.log"
CustomLog "logs/myproject.dev-access.log" common
</VirtualHost>
Now to access this, I added this line on windows/system32/drivers/etc/hosts:
127.0.0.1 myproject.dev
Now for the other computers on the network, I have to edit the hosts file of EACH computer so they can access my virtual host. (yes of course I have to use my ip address instead 127.0.0.1 for other computers)
Now my question is, is there a way that they can access my project by only using my ip address on the browser's address bar like this?
http://192.168.1.112/myproject
I mean there are 100 users that will access that project and it's a big hassle if I edit each one's hosts file. Like adding something to .htaccess, or to the routes of CodeIgniter, or to the <virtualHost>
Note:
By the way, when we are still NOT using Codeigniter (plain PHP codes), this is not a problem. But because of Codeigniter's structure, we can't do it anymore.
Can you just add a DNS entry that points to your IP address and set that as the ServerName that apache responds to?
Alternatively you can do virtual hosting based on IP address and port as described here:
http://httpd.apache.org/docs/2.2/vhosts/ip-based.html
In summary you should be able to do:
<VirtualHost 192.168.1.112:8000>
ServerAdmin admin#yahoo.com
DocumentRoot "C:/wamp/www/myproject/assets"
ServerName myproject.dev
ErrorLog "logs/myproject.dev-error.log"
CustomLog "logs/myproject.dev-access.log" common
</VirtualHost>
And have people access it via
http://192.168.1.112:8000/myproject
But, don't forget to add a Listen directive for port 8000 (or whatever you choose) if you use IP-based Virtual hosts
It might work of you create an alias called /myproject in wamp server and point the document root to 'C:/wamp/www/myproject/assets'
Make sure you have set your wamp server status to online by selecting 'Put Online' in wamp server system tray icon.
I am learning laravel framework. I have installed it on virtually and configured this C:\Windows\System32\drivers\etc\hosts windows system file. After changing this file Laravel projects working nicely but I am facing problem with other projects, they are not working and I got this error message something like
"Whoops, looks like something went wrong."
and I have configured virtual host on the system file like this
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
# ::1 localhost
127.0.0.1 laravel.test1
Is there anyone who face this problem or please suggest me something from where I can solve this problem. Or is there any terrible mistake I have done here?
Thanks
Edit also your httpd-vhosts file in yourDrive:\xampp\apache\conf\extra
and for each domain you want to have add
<VirtualHost *:80>
DocumentRoot "yourDrive:\xampp\htdocs\temp"
ServerName www.temp.dev
ServerAlias www.temp.dev
ErrorLog "yourDrive:/xampp/htdocs/temp/error.log"
<Directory "yourDrive:/xampp/htdocs/temp">
Order allow,deny
Allow from all
</Directory>
I can't for the life of me understand where the previous developer set up the configuration of the localhost system so that the application can run with a URL like:
http://my-app/index.php
instead of
http://localhost/index.php
I've checked the following files but can't find my-app anywhere:
httpd-vhosts.conf, the windows hosts file, wampmanager.tpl, wampmanager.ini, .htaccess, and files inside the wamp/bin/apache/Apachexxxx/ folder. Where on earth else should I look for this mysterious setting? The application's running on wampserver 2.1
Problem solved! It's so simple I can't believe I'd been cracking my head over this for days.
The old developer had simply renamed the computer name, from (right-click) My Computer's Properties. The name was changed to my-app. That's it.
check your hosts file. Since your running windows its in the following path
c:\windows\system32\drivers\etc\hosts
When you enter my-app.com to browser, open website under the C:/wamp/www/my-app/ folder.
About WAMP SERVER
Append to file below VirtualHost block.
Important: Below codes based under the C:/wamp/www/my-app/files. You can change what you want.
C:\wamp\bin\apache\apache2.2.22\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin info#my-app.com
DocumentRoot "C:/wamp/www/my-app/"
ServerName my-app.com
ServerAlias www.my-app.com
ErrorLog "logs/my-app.com-error.log"
CustomLog "logs/my-app.com-access.log" common
</VirtualHost>
About Windows
Append line like this:
C:\Windows\System32\drivers\etc\hosts
127.0.0.1 my-app.com
127.0.0.1 www.my-app.com
And RESTART your WAMP server..