how to change localhost/mysite/web to localhost in bitnami - apache

how to change localhost/mysite/web to localhost in bitnami
DocumentRoot "C:/Bitnami/wampstack-5.4.25-0/apache2/htdocs/srd-last/web"
i have configured httpd.conf but it is not working?
i want to call localhost.
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "C:/Bitnami/wampstack-5.4.25-0/apache2/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "C:/Bitnami/wampstack-5.4.25-0/apache2/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

I had a similar problem.
If you look towards the bottom of your http.conf file it has
Include "/path-to-bitnami-lamp/apache2/conf/bitnami/bitnami.conf
This overwrites your configuration of virtual hosts so edit virtual hosts there instead.
This problem only exists in newer version and is mentioned in the documentation -
"In recent versions of BitNami apps the bitnami.conf file defines which configuration for each application should be loaded by the Apache server. This file is located in /installdir/apache2/conf/bitnami/bitnami.conf."

DocumentRoot is the path from the root of your Web server (as in the entire file system) to your Web root (The location of where the files that make up your Web page are located)
ServerName is the name you would type into your Web browser.
For a custom ServerName to work you on local host you also need to edit your hosts file.
I think on Windows it's located at C:\windows\system32\drivers\etc\hosts

Related

All Apache virtual hosts shows default website page

Here is a problem. I am running on CentOS 7 with Httpd(Apache) installed. After installation default DocumentRoot is /var/www/html. And my site domain is avect.ru. Then I've created a virtual host with the link cp.avect.ru. But when I enter it, it shows content NOT from specified DocumentRoot /var/www/cp, but /var/www/html.
Idk why this happens. NameServers are not working, because they are deprecated. Help please!
Here is part of httpd.conf:
<VirtualHost *:80>
ServerName www.cp.avect.ru
ServerAlias *.avect.ru
DocumentRoot /var/www/cp/
ErrorLog /var/log/cp-error.log
CustomLog /var/log/cp-requests.log combined
</VirtualHost>

Issue on creating a MAMP virtualhost

I'm trying to create a MAMP virtualhost so that I can use my laravel project easier, but whatever I do I get " Not Found The requested URL / was not found on this server " when entering localhost or my vh name (cms.dev)
I tried this : How to create virtual hosts in MAMP?
And this : http://eppz.eu/blog/virtual-host-for-mamp-on-osx/
Even reinstalled MAMP and I still have the same issue, I did everything the same way it's shown in these articles.
Here's my httpd-vhosts.conf config :
#
# Use name-based virtual hosting.
#
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>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "/Desktop/MAMP"
ServerName localhost
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "/Desktop/MAMP/cms/public"
ServerName cms.dev
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
Do you guys know what's happening ???
Thanks
Your DocumentRoot paths are wrong. In MacOS, the Desktop folder is in /Users/[yourusername]/Desktop.

Virtual host points to global document root

I have a CentOS 7 server with apache. I have multiple virtual hosts running on the server. But one refuses to use the DocumentRoot that are specified for the virtual host in the http.conf file. It will only use the global DocumentRoot that are configured higher up in the httpd.conf file.
Have anyone else come across the same issue. I have been trying for a while now and i am all out good ideas.
Here is an example:
This works:
ServerAdmin uc#site1.com
DocumentRoot /var/www/site1.com/public_html
ServerName site1.com
ServerAlias *.site1.com
ErrorLog logs/site1.com-error_log
CustomLog logs/site1.com-access_log common
This doesn't work
ServerAdmin uc#site2.com
DocumentRoot /var/www/site2.com/public_html
ServerName site2.com
ServerAlias *.site2.com
ErrorLog logs/site2.com-error_log
CustomLog logs/site2.com-access_log common

Editted Virtual Host ServerName in httpd.conf but it seems it did not take effect

So I have 4 Virtual Host. I made the 3 Virtual Hosts 2 days ago and it
all works fine. When I made another Virtual Host the next day, it
won't load up the newly created Virtual Host. So I tried renaming the Server Name of my 1st Virtual
Host which is running.
I changed the ServerName and Alias of www.test1.biboglobal.com to hogehoge.com with still the directory of test1. Saved the file and restarted apache. But when I tried to browse hogehoge.com,it won't load the contents.
I tried browsing the test1.biboglobal.com and it still worked. But
that Server Name does not exist anymore because I changed it to
hogehoge.com.
I've searched all about httpd.conf not taking changes but found no answer. I hope someone can help me.
I also tried removing all Virtual Hosts and restarted Apache. But still, it was able to browse test1, test2, test3.biboglobal.com. Although it only displayed the Apache Test Page, not the index.html inside their respective directory.
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
ServerAdmin webmaster#hogehoge.com //**This was supposed to be test1.biboglobal.com**
DocumentRoot /var/www/test2.biboglobal.com/public_html
ServerName www.hogehoge.com //**This was supposed to be test1.biboglobal.com**
ServerAlias hogehoge.com //**This was supposed to be test1.biboglobal.com**
ErrorLog /var/www/test1.biboglobal.com/error.log
# CustomLog /var/www/test1.biboglobal.com/requests.log
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#test2.biboglobal.com
DocumentRoot /var/www/test2.biboglobal.com/public_html
ServerName www.test2.biboglobal.com
ServerAlias test2.biboglobal.com
ErrorLog /var/www/test2.biboglobal.com/error.log
# CustomLog /var/www/test2.biboglobal.com/requests.log
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#test3.biboglobal.com
DocumentRoot /var/www/test3.biboglobal.com/public_html
ServerName www.test3.biboglobal.com
ServerAlias test3.biboglobal.com
ErrorLog /var/www/test3.biboglobal.com/error.log
# CustomLog /var/www/test3.biboglobal.com/requests.log
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#test4.biboglobal.com
DocumentRoot /var/www/test4.biboglobal.com/public_html
ServerName www.test4.biboglobal.com
ServerAlias test4.biboglobal.com
ErrorLog /var/www/test4.biboglobal.com/error.log
CustomLog /var/www/test4.biboglobal.com/requests.log common
</VirtualHost>

VIrtualHost: Different hosts point to the same location

I am trying to set virtual hosts for two Zend Framework applications. I started by changing the system32 hosts file.
It contains the following lines now:
127.0.0.1 localhost
# ::1 localhost
127.0.0.1 quickstart
After that, I proceeded with changing the httpd-vhosts.conf file. Its current content:
<VirtualHost *:80>
ServerAdmin postmaster#dummy-host2.localhost
DocumentRoot "G:\workspace\Andrew\ProjManer\public"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin postmaster#dummy-host2.localhost
DocumentRoot "G:\workspace\Andrew\quickstart\public"
ServerName quickstart
ServerAlias quickstart
ErrorLog "logs/quickstart-error.log"
CustomLog "logs/quickstart-access.log" combined
</VirtualHost>
If I don't add the virtual host with localhost first, I get a "Access forbidden 403 Error message".
The problem now is that both point to the same location, the localhost. How am I supposed to get the second virtual host working? I used the flushdns also.
You don't need the ServerAlias in them unless you want say quickstart2 to go to quickstart. In that case you will do ServerAlias quickstart2. You get access forbidden because your document root in your httpd.conf doesn't have an index.php or that virtualhost doesn't have an index.php and you have -Indexes set
Other than that the virtualhost and hosts file look fine. Try restarting your browser and restarting apache.