wampserver 404 error The requested URL was not found on this server - wampserver

I installed wamp server and it works fine as the icon color is green and even the localhost works fine, but the problem happens when I add any PHP file inside www folder and try to access the file it gives me this message:
404 error The requested URL was not found on this server.
Any help will be appreciated.

How to run PHP project or files on wamp server at localhost?
Run wamp server
Create PHP project or file inside C://wamp/www/ directory.
Run your project or file means open URL in Browser ex: http://localhost/file_name.php or folder name
If a folder has an index.php file it will run by calling folder name in URL.

Running your project or file; means opening the URL in a browser
Example: 
http://localhost/file_name.php or folder name

You should check the httpd-vhosts.conf file via /wamp64/bin/apache/apache2.4.41/conf/extra/httpd-vhosts.conf. the follwings; the port numbers here for example 83 cause it was my choice:
# Virtual Hosts
#
<VirtualHost *:83>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<VirtualHost *:83>
ServerName myProject
DocumentRoot "d:/wamp64/www/spip-projet-v"
<Directory "d:/wamp64/www/spip-projet-v/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

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.

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

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.

zend framework skeleton application not showing properly

I have installed the Skeleton Application manually. My application is kept in "D:\xampp\htdocs\zf2". I've created a virtual host in the following way, in httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerName zf2
DocumentRoot "D:/xampp/htdocs/zf2/public/index.php"
<Directory "D:/xampp/htdocs/zf2/public/index.php">
#DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
but it does not shown properly and it gives the output
and the remain ing application with module and database shows also not shows in the proper way
but if i slightly modify in virtual host settings of
DocumentRoot "D:/xampp/htdocs/zf2/public/index.php"
to
DocumentRoot "D:/xampp/htdocs/zf2/public"
then, skeleton application shows fine but when i configure module and database it gives error "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. zend sleleton application error"
can any one help me i have waste lot of time to set it but didn't.
You need to set document root to the folder not a file. The page looks messed up when pointing to index.php as documentroot because it cannot find the stylesheets.
The issue with configuring the module/database is probably a different issue, and you would have to post your module/database configuration to get help there.

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

Passenger on Ubuntu still only serving default index.html

Trying to get my server to serve my rails apps.
I have a test app installed, apache2 and passenger have been installed have I have added the following to the apache2.conf
# Include the virtual host configurations:
Include sites-enabled/
NameVirtualHost localhost:80
<VirtualHost localhost:80>
ServerName 192.168.1.67
DocumentRoot /home/john/Public/test-app
</VirtualHost>
Clearly, I am misunstanding something, because I think that should redirect calls to my local IP to my rails app. It is not. It is going to the default apache index.html.
What am I doing wrong?
UPDATED answer:
I think you are missing the "Directory" node. try using this config code:
(assuming your project path is: /home/john/Public/test-app)
<VirtualHost *:80>
DocumentRoot /home/john/Public/test-app/public
RailsEnv development
<Directory /home/john/Public/test-app/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
This is how I usually do it:
<VirtualHost *:80>
ServerName mysubdomain.betamaster.us
DocumentRoot /var/www_home/mysubdomain/
</VirtualHost>
After applying these changes make sure to execute
/etc/init.d/apache2 reload
in order to reload the server configuration.
I had the same symptoms in this question but it was a different problem. My apache install already had a Virtual host enabled, so I had to disable it and enable my own with the commands
sudo a2dissite default
sudo a2ensite myapp
where default was the name of the Virtual Host file included by default in sites-avaliable/ and myapp is the file i added.
Hopefully this helps someone.

Resources