I created a virtual host in xampp. I cannot use port 80 so I'm using port 8080. I then call servername:8080 to get the index.php. It works fine but I cannot do an ajax call, then an error occurs. What is wrong?
vhost
<VirtualHost 127.0.0.1:8080>
DocumentRoot "somepath"
ServerName servername
<directory "somepath">
usual stuff here
</directory>
</VirtualHost>
Call index.php
http://servername:8080
Error ajax
GET http://servername:8080/contact.html 404 (Not Found)
jquery-2.1.0.min.js:4l.cors.a.crossDomain.send jquery-2.1.0.min.js:4o.extend.ajax
jquery- 2.1.0.min.js:4o.(anonymous function) jquery-2.1.0.min.js:4start_loading
main.js:516click_internal_link main.js:547(anonymous function)
main.js:670o.event.dispatch jquery-2.1.0.min.js:3r.handle
Try this: (open by xampp panel the Apache config and in the end add the following:)
Setting Up Your VHOST
=====================
The following is a sample VHOST you might want to consider for your project.
NameVirtualHost 127.0.0.1:80
VHOST for Windows
=====================
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/..."
ServerName localhost
# This should be omitted in the production environment
#SetEnv APPLICATION_ENV development
#SetEnv APPLICATION_ENV production
<Directory "C:/xamp/htdocs/...">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
AND this: in your windows hosts
C:\WINDOWS\system32\drivers\etc
Edit hosts:
127.0.0.1 localhost
Good luck ;)
Related
Im on windows 10, trying to customize an url to use Laravel. I dont want to acess the url using public folder on it. Im using wamp and apache is running on port 8080. So I edit the file wamp\bin\apache\apache2.4.23\conf\extra\httpd-vhosts.conf like this:
<VirtualHost *:80>
DocumentRoot c:/wamp/www/
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot c:/wamp/www/laravel_test/blog/public
ServerName laravel_test.dev
</VirtualHost>
After that, I edit the file system32/drivers/etc/hosts with:
127.0.0.1 localhost
127.0.0.1 laravel_test.dev
And when I access the url laravel_test.dev it doesnt work. I tried to use this too on httpd-vhosts.conf:
<VirtualHost *:8080>
And it doesnt work either. I always restart the service on wamp, and nothing changes.
I couldnt install and configure the homestead properly, so im trying to use wamp now. Can somebody help me?
In your httpd.conf file you need to uncomment the virtual Hosts section
Then,
Your vhost needs to listen on port 8080
<VirtualHost *:8080>
ServerName laraveltest.dev
ServerAlias www.laraveltest.dev
DocumentRoot c:/wamp/www/laravel_test/blog/public
<Directory "c:/wamp/www/laravel_test/blog/public">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
For your hosts file
127.0.0.1 laraveltest.dev www.laraveltest.dev
I am struck Here, create one project, project name is medicals.
I am Using xampp. i wrote in http.conf like.
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs/medicals/public"
ServerName medicals.com
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "C:/xampp/htdocs/medicals/public">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And,Using Windows path:C:\Windows\System32\drivers\etc point to.
127.0.0.1 medicals.com
i have an error im my browser to access the medicals.com.
Where is the actual issue. i did't understand.
Thhanks in advance.
Please Confirm your port is 80, In case you use another port in xampp u can change the line <VirtualHost *:80> to <VirtualHost *:8080>, the 8080 is a port number second commonly used, you change 8080 into your port,
your port number shown in xampp control pannel PFA
Copy following code :
<VirtualHost *:80>
ServerName medicals.com
DocumentRoot "C:/xampp/htdocs/medicals/public"
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/medicals/public">
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
To:
C:/xampp/apache/conf/extra/httpd-vhosts.conf
And also add following line :
127.0.0.1 medicals.com
to
C:/Windows/System32/drivers/etc
And also make sure your mod_rewrite is enabled and don't forget to restart your apache server after change.
This works for me in zf3. If it does not work in zf1 you may want to look at this.
https://framework.zend.com/manual/1.10/en/project-structure.rewrite.html
I just started learning php and I am trying to host locally my own php website by using XAMPP.
I wanted to create virtual host with:
URL: myphpwebsite.local
Port: 8088
But when I attempted to access this website through the browser I got a:
Not Found
HTTP Error 404. The requested resource is not found.
Does anyone know what the problem is?
My httpd-vhosts.conf
NameVirtualHost 127.0.0.1:8088
<VirtualHost 127.0.0.1:8088>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost myphpwebsite.local>
DocumentRoot "C:/Microsoft/Workspace/myphpwebsite"
ServerName myphpwebsite.local
ErrorLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.error.log"
CustomLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.custom.log" combined
<Directory "C:/Microsoft/Workspace/myphpwebsite">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And my C:\Windows\System32\drivers\etc\hosts file:
127.0.0.1 localhost
127.0.0.1 myphpwebsite.local
Any help would be appreciated!
make sure there's file/htaccess/index or whatever in directory you want to open, 404 may comes from that ;)
try using one below, eventually replace your port:
<VirtualHost *:80>
DocumentRoot "C:/Microsoft/Workspace/myphpwebsite"
ServerName myphpwebsite.local
</VirtualHost>
the question is your Apache running/serving on port 8088?
For example my xamp is running on 80 and 443...
xamp control panel is very handy, it has nice logs button that will open your log files to show you php and apache errors etc. check it out.
Try going with default port, if it works it means that you need to play with ports if you really want to.
just a quick tip, .com is shorter than .local and if you're using chrome and it works like mine then most of the time something.local will redirect you to google search (and I like my search there, you can switch it off ;))
I don't know if I am much help, but using WAMP, here are my settings. I am listening on port 80, I use 8080 for my tomcat server.
hosts file
127.0.0.1 local.mysite.com
httpd-vhosts.conf
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
....
<Directory "c:/wamp/www">
Options Indexes MultiViews FollowSymLinks
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
<VirtualHost *:80>
ServerName localhost
DocumentRoot "c:/wamp/www"
</VirtualHost>
<Directory "c:/wamp/www/path/to/site/root">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName local.mysite.com
DocumentRoot "c:/wamp/www/path/to/site/root"
ServerAdmin me#email.com
ProxyPreserveHost Off
RewriteEngine On
AllowEncodedSlashes NoDecode
#AllowEncodedSlashes On
ErrorLog "c:/wamp/www/path/to/logs/error.log"
CustomLog "c:/wamp/www/path/to/logs/access.log" common
</VirtualHost>
....
Then I can access my local site like this: http://local.mysite.com
Hope this helps...
The NameVirtualHost directive needs to match the value of VirtualHost exactly, and you need to specify the port in each instance. If you want to use port 8088 for myphpwebsite.local, you'd need to do:
NameVirtualHost 127.0.0.1:8088
<VirtualHost 127.0.0.1:8088>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1:8088>
DocumentRoot "C:/Microsoft/Workspace/myphpwebsite"
ServerName myphpwebsite.local
ErrorLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.error.log"
CustomLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.custom.log" combined
<Directory "C:/Microsoft/Workspace/myphpwebsite">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Notice the VirtualHost opening tags are identical; it's the ServerName value that actually tells Apache which domain this particular directive applies to. Restart your server after making the changes. Check out this page for more information: http://httpd.apache.org/docs/2.2/vhosts/name-based.html
Hope this helps!
Make sure that the port you are using is not being used by another service.
I have installed wamp a handful of times, and have it working on my local environment. Currently I am attempting to resolve an issue on a server of mine which is running wamp. I uninstalled a working copy, and now when I attempted to reinstall I have been unsuccessful. I have changed the port to be 8080 and have configured the httpf.config to do so.
ServerName 50.56.176.95:8080
ServerRoot "C:/wamp/bin/apache/apache2.4.9"
Listen 50.56.176.95:8080
<virtualHost *:8080>
DocumentRoot "c:/wamp/www/Hi"
ServerName 50.56.176.95
</virtualHost>
<virtualHost *:8080>
DocumentRoot "c:/wamp/www/Hi"
ServerName 50.56.176.95
<directory "c:/wamp/www/Hi">
Order allow,deny
Allow from all
Require all granted
</directory>
</virtualHost>
Wamp turns on and apache and php start up, however if I attempt o access 50.56.176.96:8080 I will get a 404 error.
Something to note is that everything is commented out in the htacces file in the www directory.
Should the ServerName not actually be a name and not an ip address?
Also you are using Apache 2.2 and Apache 2.4 access control syntax in the same VH def? As you are using Apache 2.4 it may be best to stick to 2.4 syntax.
So maybe this will work :-
<VirtualHost *:8080>
DocumentRoot "c:/wamp/www/Hi"
ServerName hi.com
ServerAlias www.hi.com
<Directory "c:/wamp/www/Hi">
Require all granted
</Directory>
</VirtualHost>
Im trying to redirect to a web page on my localhost, I have done all the nessesary configurations from my hosts files and v-hosts it picks up my address from my C:\Windows\System32\drivers\etc hosts file which is name.local but does not show the main page. Keeping in mind the site has both front and backend access. I'm new and wanna work on my application locally before i can start editing it on the server.
You posted this additional comment containing your vhost definition and hosts file contents
v-host file
<VirtualHost 127.0.0.1:80>
DocumentRoot "c:/xampp/htdocs/intranet"
ServerName gep.local
ServerAlias gep.local
CustomLog "c:gep.local-access_log" combined
ErrorLog "c:gep.local-error_log"
<Directory "c:/xampp/htdocs/intranet">
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
host file:
127.0.0.1 gep.local
Here are a few suggestions:-
Have you rebooted or restarted the DNS Client to activate your HOSTS file changes.
from a command window run started using 'Run as Administrator' do this
net stop "DNS Client"
then once it reports as STOPPED
net start "DNS Client"
This will refresh the windows DNS Cache. ( Double quotes are required as there is a space in the service name )
First change <VirtualHost 127.0.0.1:80> to <VirtualHost *:80>
If you are using Apache 2.2.x you also need a NameVirtualHost *:80 parameter as the first parameter in the vhost definition file. If you are using Apache 2.4.x I believe they removed this requirement so it is not necessary on that version of Apache.
So
new v-host file
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/intranet"
ServerName gep.local
ServerAlias gep.local
CustomLog "c:/gep.local-access_log" combined
ErrorLog "c:/gep.local-error_log"
<Directory "c:/xampp/htdocs/intranet">
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Then of course to test it use the address `http://gep.local' in your browser address bar to get to this new virtual host.