Virtual host and subdomains on Wamp windows - virtualhost

I want to create virtual host and sub-domains for that host on local machine such that my localhost serve as a website like I do not need to write localhost in url bar:
localhost ---> mysite.com
---> sd1.mysite.com
---> sd2.mysite.com
actually I am using wordpress plugin WP Subdomains which makes sub-domain for main categories like.
cat1.localhost
cat2.localhost
but if we try to access cat1.localhost browser error Server not found which is definitely because we did not create sub-domain named cat1 for localhost.
I google but no solution found which exactly solve my problem.
I also followed http://www.talkphp.com/general/2170-setup-sub-domain-wamp.html
but following error appear:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, admin#localhost and inform
them of the time the error occurred, and anything you might have done
that may have caused the error.
More information about this error may be available in the server error
log.

Okay got it....
I followed http://www.talkphp.com/general/2170-setup-sub-domain-wamp.html but skip step 3:
Open up: C:\wamp\bin\apache\apache2.2.6\conf\extra\httpd-vhosts.conf.
and in httpd.conf comment DocumentRoot "E:/wamp/www/" and add
DocumentRoot "E:/wamp/www/wordpress"
and it work. :)

Please follow the link below. I tried this and working fine for me.
http://www.axertion.com/tutorials/2012/03/how-to-setup-local-subdomains-using-wampserver/

Related

How to enable Virtual Host on Xampp for Laravel 5.8

I have problem with creating virtual host. I am using Windows 7 x64 Professional.
When i try click on any admin menu dashboard got this error:
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.39 (Win64) OpenSSL/1.1.1c PHP/7.3.6
And in file C:\xampp-x64-7.3.6-1-VC15\apache\conf\extra\httpd-vhosts.conf I have this:
DocumentRoot "C:\xampp-x64-7.3.6-1-VC15\htdocs\gametrade150.lt\public"
ServerName gametrade150.lt
And of course I have restared my Apache server after adding this lines in those files.

Apache Internal Server Error after adding htaccess to the website

I'm getting following error in my apache localhost server.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Previously it worked properly.But recently enabled the Apache Proxy Module.
Finally i could solved the issue by myself.The issue was at apache configuration file.

serving laravel with apache vhost

I followed instructions and added in my httpd-vhost.conf file
<VirtualHost *:80>
ServerName project-laravel-learn.my
DocumentRoot "/srv/http/project-laravel-learn.my/public/"
</VirtualHost>
also added like for other local projects, map in hosts file so that
project-laravel-learn.my goes resolves to 127.0.0.1
http (web user), has all permissions to write and read on that public
folder,
also app/storage is rw- for http,
however, when I visit project-laravel-learn.my I get page saying
Whoops, looks like something went wrong!
What might be the problem? Also how I can get more detailed error message as
this one above isn't that much useful.
Just to add, app was working fine before I moved it to /srv/http/, while developing and using php artisan serve command.
EDIT: Ok it works, I forgot to start my local web server instance, however now routing does not work, I get only homepage, but clicking on any link gives 404 object not found error!?
How to fix that?
Found solution here..
http://www.epigroove.com/blog/laravel-routes-not-working-make-sure-htaccess-is-working
I will leave it for a future reference.

Unable to hit https for certain projects

I have a project in xampp/htdocs/project1
I needed to create another project so I decided to assign them different ports so now,
xampp/htdocs/project1 runs on 8080
and my project2 which is under
C:/release/project2 runs on 7171
I needed to make project2 https , so created ssl certificate and everything is setup in apache too.(listening to 443)
https:/xx.xx.xx.xxx:443/project1/login.php gave error
whereas https:/xx.xx.xx.xxx:443/project2/login.php could be hit.
so i did following change in httpd-ssl.conf,
DocumentRoot "C:/xampp/htdocs" to DocumentRoot "C:/release"
but now i get the error -
Access forbidden!
You don't have permission to access the requested object. It is either
read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
This error is given for both,
https:/xx.xx.xx.xxx:443/project1/login.php
and https:/xx.xx.xx.xxx:443/project2/login.php
I thought it was permission problems, but i can still hit these
https:/xx.xx.xx.xxx:8080/project1/login.php
and https:/xx.xx.xx.xxx:7171/project2/login.php
What could be the problem? I am new to website development so could not figure out what I am doing wrong.Is project being under htdocs compulsory for this or assigning of different ports was wrong?
You might have got it working by now,
But It seems like the permissions are not set.
It is not compulsary to have the project under htdocs.Since your project is working on 7171 everything might be fine.
you can try following,
1) for permissions, Check if you have AllowOverride All Order allow,deny Allow from all set in httpd.conf too.Restart the server.
If it still doesnt work,
2) check if http://www.youtube.com/watch?v=ZUAKLUZa-AU can help.

iis and apache combination on real server for 403

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!