Why does my entry in the "Your Virtual Hosts" submenu not contain the full name of the host? - wampserver

I have set up a new virtual host on WAMP Server version 3.0.6 which contains a dot in the name (specifically bowla300.local)
My vhosts.conf file is configured to call it bowla300.local, as is also my hosts file. When I restart WAMP the localhost page shows this name correctly in both the Your Projects and Your Virtual Hosts columns and the links work as expected. So far so good... But on the Your Virtual Hosts menu from the main WAMP server the server name appears only as bowla300 without the .local at the end and the link does not work. I don't know what I need to change to correct this. It is possible that I initially set the site name up incorrectly without the ".local" but having subsequently revisited vhosts.conf the name is now definitely correct and the fact it appears correct on the localhost page also suggests it is valid. Any ideas why the menu entry may not be including the ".local"?
I attach my vshosts entries as below (which I admit I did hand edit as I have only just noticed the option on the local host page to create a virtual host that way):-
<VirtualHost *:8080>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:8080>
ServerName bowla300.local
DocumentRoot "c:/wamp64/www/bowla300.local"
<Directory "c:/wamp64/www/bowla300.local/">
Options Indexes FollowSymLinks
AllowOverride All
Require local
</Directory>
</VirtualHost>

The problem resolved itself after a clean reboot. Restarting WAMP was not sufficient but restarting the operating system fixed it.

Related

WAMP doesn't seem to be changing IP address to a domain

I'm trying to change how I access my website from WAMP server. I can access it like xxx.xxx.xxx.xxx/name, yes, it works perfectly fine. I searched up on how to change "xxx.xxx.xxx.xxx/name" to a domain name like www.name.com, I got some results but none of them worked. These are the things I did:
First I went to my host file
C:\Windows\System32\drivers\etc
, added a line "127.0.0.1 mytestdomain.com", this is how it looks:
host file
Next, I changed "#Include conf/extra/httpd-vhosts.conf" to "Include conf/extra/httpd-vhosts.conf" from httpd.conf located at:
"D:\wamp64\bin\apache\apache2.4.27\conf"
.
Lastly, I added
<VirtualHost mytestdomain.com>
DocumentRoot "D:/wamp64/www/myTestDomain/"
ServerName mytestdomain.com
ServerAlias mytestdomain.com
<Directory "D:/wamp64/www/myTestDomain/">
Order allow, deny
Allow from all
</Directory>
</VirtualHost>
on "httpd-vhosts.conf" located at:
"D:\wamp64\bin\apache\apache2.4.27\conf\extra"
Oh, and yes, this is inside myTestDomain folder: myTestDomain
After doing all this, I restarted WAMP and went to my domain main, but it doesn't seem to be working, meanwhile "xxx.xxx.xxx.xxx/myTestDomain" does seem to be working.
Your HOSTS file should look like this
127.0.0.1 localhost
127.0.0.1 mytestdomain.com
::1 localhost
::1 mytestdomain.com
Your Virtual Host definition like this
<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/wamp64/www
<Directory "D:/wamp64/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/wamp64/www/myTestDomain/"
ServerName mytestdomain.com
ServerAlias mytestdomain.com
<Directory "D:/wamp64/www/myTestDomain/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Alternatively open the wampserver home page and use the Add a Virtual Host link under the Tools menu, and it will all be done for you correctly.
NOTE: Using .com is a bad idea unless you actually intend to host your live site from your PC, instead use a .dev for example. Change the HOSTS file accordingly.
Bigger NOTE: Hosting a live site from a PC is a very bad idea. If you are using a desktop OS it is not configured to cope with more than 30 external connections so if your site gets even vaguely popular, users will get a terrible experience, most of them queuing for connections for page parts to be downloaded.

How to change the URL from "localhost" to something else, on a local system using wampserver?

On a Windows machine, there's a system running on the local wampserver, but while the application is running on localhost, the URL says otherwise.
While I would expect the URL to be like this based on the directory structure:
http://localhost/pro/include/db_report.php
The developer has managed to do this:
http://ap-mispro/pro/include/db_report.php
So instead of localhost, the URL says ap-mispro.
And both URLs work fine.
How is the second URL made? I tried checking out the wampmanager.ini and wampmanager.tpl but maybe I didn't know what to look for?
WINDOWS + WAMP solution
Step 1
Go to C:\wamp\bin\apache\Apache2.2.17\conf\ open httpd.conf file and change #Include conf/extra/httpd-vhosts.conf to Include conf/extra/httpd-vhosts.conf i.e. uncomment the line so that it can includes the virtual hosts file.
Step 2
Go to C:\wamp\bin\apache\Apache2.2.17\conf\extra and open httpd-vhosts.conf file and add the following code
<VirtualHost myWebsite.local>
DocumentRoot "C:/wamp/www/myWebsite/"
ServerName myWebsite.local
ServerAlias myWebsite.local
<Directory "C:/wamp/www/myWebsite/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
change myWebsite.local and C:/wamp/www/myWebsite/ as per your requirements.
Step 3
Open hosts file in C:/Windows/System32/drivers/etc/ and add the following line ( Don't delete anything )
127.0.0.1 myWebsite.local
change myWebsite.local as per your name requirements
Step 4
restart your server. That's it
WINDOWS + XAMPP solution
Same steps as that of WAMP just change the paths according to XAMPP which corresponds to path in WAMP
Copy the hosts file and add 127.0.0.1 and name which you want to show or run at the browser link. For example:
127.0.0.1 abc
Then run abc/ as a local host in the browser.
They are probably using a virtual host (http://www.keanei.com/2011/07/14/creating-virtual-hosts-with-wamp/)
You can go into your Apache configuration file (httpd.conf) or your virtual host configuration file (recommended) and add something like:
<VirtualHost *:80>
DocumentRoot /www/ap-mispro
ServerName ap-mispro
# Other directives here
</VirtualHost>
And when you call up http://ap-mispro/ you would see whatever is in C:/wamp/www/ap-mispro (assuming default directory structure). The ServerName and DocumentRoot do no have to have the same name at all. Other factors needed to make this work:
You have to make sure httpd-vhosts.conf is included by httpd.conf for your changes in that file to take effect.
When you make changes to either file, you have to restart Apache to see your changes.
You have to change your hosts file
http://en.wikipedia.org/wiki/Hosts_(file) for your computer to know
where to go when you type http://ap-mispro into your browser. This
change to your hosts file will only apply to your computer - not
that it sounds like you are trying from anyone else's.
There are plenty more things to know about virtual hosts but this should get you started.
please refer http://complete-concrete-concise.com/web-tools/how-to-change-localhost-to-a-domain-name
this is best solution ever
for new version of Wamp
<VirtualHost *:80>
ServerName domain.local
DocumentRoot C:/wamp/www/domain/
<Directory "C:/wamp/www/domain/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
After another hour or two I can actually answer my own question.
Someone on another forum mentioned that you need to keep a mention of plain ol' localhost in the httpd-vhost.conf file, so here's what I ended up with in there:
ServerName localhost
DocumentRoot "c:/wamp/www/"
DocumentRoot "C:/wamp/www/pocket/"
ServerName pocket.clickng.com
ServerAlias pocket.clickng.com
ErrorLog "logs/pocket.clickng.com-error.log"
CustomLog "logs/pocket.clickng.com-access.log" common
<Directory "C:/wamp/www/pocket/">
Options Indexes FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Exit WAMP, restart - good to go. Hope this helps someone else :)
go to C:\Windows\System32\drivers\etc and open hosts file and add
this
127.0.0.1 example.com
127.0.0.1 www.example.com
then go to C:\xampp\apache\conf\extra open httpd-ajp.conf file and add
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/pojectroot"
ServerName example.com
ServerAlias www.example.com
<Directory "C:/xampp/htdocs/projectroot">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
WINDOWS + MAMP solution
Step 1
Go to S:\MAMPenter code here
\bin\apache\conf\ open httpd.conf file and change
#Include conf/extra/httpd-vhosts.conf
to
Include conf/extra/httpd-vhosts.conf i.e. uncomment the line so that it can includes the virtual hosts file.
Step 2
Go to S:\MAMP\bin\apache\conf\extra and open httpd-vhosts.conf file and add the following code
<VirtualHost myWebsite.local>
DocumentRoot "S:\MAMP\htdocs/myWebsite/"
ServerName myWebsite.local
ServerAlias myWebsite.local
<Directory "S:\MAMP\htdocsmyWebsite/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
change myWebsite.local and S:\MAMP\htdocs/myWebsite/ as per your requirements.
Step 3
Open hosts file in C:/Windows/System32/drivers/etc/ and add the following line ( Don't delete anything )
127.0.0.1 myWebsite.local
change myWebsite.local as per your name requirements
Step 4
restart your server. That's it
This method will work for xamp/wamp/lamp
1st go to your server directory, for example, C:\xamp
2nd go to apache/conf/extra and open httpd-vhosts.conf
3rd add following code to this file
<VirtualHost myWebsite.local>
DocumentRoot "C:/wamp/www/php-bugs/"
ServerName php-bugs.local
ServerAlias php-bugs.local
<Directory "C:/wamp/www/php-bugs/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
For DocumentRoot and Directory add your local directory
For ServerName and ServerAlias give your server a name
Finally go to C:/Windows/System32/drivers/etc and open hosts file
add 127.0.0.1 php-bugs.local and nothing else
For the finishing touch restart your server
For Multile local domain add another section of code into httpd-vhosts.conf
<VirtualHost myWebsite.local>
DocumentRoot "C:/wamp/www/php-bugs2/"
ServerName php-bugs.local2
ServerAlias php-bugs.local2
<Directory "C:/wamp/www/php-bugs2/">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and add your host into host file 127.0.0.1 php-bugs.local2

confused about apache server virtual host

So I configured a VirtualHost in the httpd-vhosts.conf directory, but whenever I navigate to the servername, it seems to always give me the page listed in httpd.conf.
I am new to apache web server and am not sure what else I need to do.
In my httpd-vhosts.conf I have
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName helloworld.com
DocumentRoot /Users/username/Desktop/RailsDemo/depot/public/
<Directory /Users/username/Desktop/RailsDemo/depot/public/>
AllowOverride all
Options -MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
In my httpd.conf, I have default settings, so I didn't change anything since install.
Also, I have matched helloworld.com to the correct ip address. Typing helloworld.com into the browser produces the wrong view...it produces the view indicated in httpd.conf.
If this helps, I am trying to do p. 238 of Pragmatic Agile Web Development with Ruby on Rails (4th Edition) -- Iteration K1: Deploying with Phusion Passenger and MySQL
Any help would be appreciated, thanks!
You seem to be running Mac OS X. In your httpd.conf, you will have the lines;
# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf
Remove the comment, making it
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
Restart apache, and that should activate your named vhost.

Phusion Passenger + Apache 2 + Rails 3. Works on local network, not when accessed externally

The problem:
I have created a Rails project skeleton using rails new TestApp in the /var/www/ directory of my server. The Rails default index.html displays and works properly (i.e., you see the rails logo and when you click on "About your application's environment" you get a correct listing of the environment specifications used on the server) when I access the site from the same network on which the server is running. However, if I access the site from a machine on a different network than the server's, the page displays but I do not get the rails logo image, and clicking on "About your application's environment" results in the following error display on the page:
Not Found
The requested URL /TestApp/rails/info/properties was not found on this server
And that URL shouldn't be found, because it doesn't exist. However, TestApp/public/rails/info/properties does exist.
Configuration:
The site resides in /var/www/TestApp and I access it from a Sub-URI. I have created a symbolic link in /var/www/ called rails as follows: rails -> /var/www/TestApp/public, such that the project can be accessed from www.mydomain.com/rails. My Apache configuration is the following, note that I've omitted,changed, or shortened some parts within the <VirtualHost> tag for brevity:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/ex$
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName www.mydomain.com
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
.
.
.
#Rails Configuration
RailsBaseURI /rails
RailsEnv development
PassengerUserSwitching off
PassengerDefaultUser www-data
<Directory /TestApp/public>
Options FollowSymLinks -MultiViews
AllowOverride All
Allow from all
</Directory>
#End Rails Configuration
.
.
.
</VirtualHost>
A couple of things: the appropriate folders are owned by www-data with the appropriate permissions as defined by the Passenger documentation. When setting up the symlink and RailsBaseURI settings I followed the Passenger documentation.
I guess I'm at a loss here since everything seems to be working when accessing the website from the same network on which the server resides. I'm not sure why things aren't working out when accessing the site from a different network, but I feel like paths to certain resources/assets (like the rails logo) aren't resolving properly. Perhaps my symlink is configured inappropriately, or something is wrong with my Apache configuration?
Any help would be appreciated.
The issue of a somewhat broken default Rails page is not totally abnormal, it turns out.
I removed the default Rails page and replaced with another page that included some Rails code and everything worked like a charm.

Apache and passenger setup virtualhost restart failing

I have installed passenger on my Ubuntu 10.x server and I am running Apache2. I have followed the instruction "I think" pretty well. After setting up my virtual host and trying to restart I am getting a failed to start apache error because Documentroot takes one argument. I have the document root set is the thing so I am wondering if you guys could offer some suggestions as to what I may be doing wrong.
I have all my virtual hosts in separate files by domain name, so the directory structure on the server is something like this
/etc/apache2/sites-available/dev.mydomain.com
/etc/apache2/sites-enabled/dev.mydomain.com
both files have the following in them but restarting apache only fails when I put the vhost info in the enabled file.
<VirtualHost *:80>
ServerName dev.mydomain.com
DocumentRoot /home/myfolder/dev/vb/public # <-- be sure to point to 'public'!
<Directory /home/myfolder/dev/vb/public>
AllowOverride all # <-- relax Apache security settings
Options -MultiViews # <-- MultiViews must be turned off
</Directory>
</VirtualHost>
Thanks for any help you can offer.
Comments in httpd.conf must go on their own line.
have you given before defining VirtualHost
NameVirtualHost *:80
if this given remove those commented line after document root and try

Resources