I am using XAMPP and running PORT:8080. I am trying to set up a virtual host and have tried every thing on the internet to set it up but still finding it difficult.
It shows this ERROR on chrome
ERR_SSL_PROTOCOL_ERROR
and this ERROR on Firefox
Error code: SSL_ERROR_RX_RECORD_TOO_LONG
Please need help on this...
My vhosts.conf file
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs/lsapp/public"
ServerName lsapp.dev
ServerAlias www.lsapp.dev
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/lsapp/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
my windows host file
127.0.0.1 localhost
127.0.0.1 lsapp.dev
Source
A while back, Google purchased the .dev TLD (Top Level Domain). At that time, they announced that they had no plans for it and that they were only going to use it for internal purposes. For years, the .dev TLD was primarily used for developers and designers to use in their local development environments. It was considered general acceptable use and, as a result, developers everywhere are now running sites locally which may now be affected.
Recently Google announced that in a soon to be released update to Chrome, they will be forcing .dev to HTTPS. In short, this means that if you are running local sites using .dev AND running Google Chrome, you will find your site unreachable. Fortunately, there are a couple of options which are fairly simple to implement to get around this issue. Keep in mind that since .dev has been a standard TLD for local development for some time, this new policy by Google will affect you whether you are using DesktopServer or any other local development tool which utilizes the .dev TLD. This issue is NOT specific to DesktopServer.
In short you need to change your .dev extension to anything else. If you still want to use .dev in the virtual host than you can try this workaround:-
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs/lsapp/public"
ServerName dev.lsapp.com
ServerAlias dev.lsapp.com
SetEnv APPLICATION_ENV "development"
<Directory "C:/xampp/htdocs/lsapp/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And in your windows host file:-
127.0.0.1 dev.lsapp.com
Don't forget to restart the server to load new changes.
if it doesn't work just type http://dev.lsapp.com:8080/ on your browser and it absolutely works thanks.
Related
After modifying the both the file (httpd-xamp.conf & httpd-vhosts.conf ) I can't access my website either in my localhost nor other computer.
typing in the browser address bar:
mydomain.local
But it only works in localhost computer when we when we type "localhost/phpmyadmin/"
when I'd like to allow another computer in the same LAN to access the website. I've configured the other computer hosts file to contain line:
192.168.1.180 mydomain.local
where 192.168.1.180 is the XAMPP computer IP address. But after typing the http://mydomain.local on the other computer browser, after pressing enter, the address becomes: http://mydomain.local/dashboard and message appear "Object not found & error 404".
So far, I have done this:
Changed c:\xampp\apache\conf\extra\httpd-xamp.conf file to contain this
Order deny,allow
Deny from all
Allow from ::1 127.0.0.0/8 192.168.1.180
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
On my XAMPP computer, I have the following configuration in c:\xampp\apache\conf\extra\httpd-vhosts.conf:
NameVirtualHost *:80
ServerAdmin postmaster#dummy-host2.localhost
DocumentRoot "C:/xampp/htdocs/myphpapp"
ServerName mydomain.local
ServerAlias mydomain.local
ErrorLog "logs/mydomain.local-error.log"
CustomLog "logs/mydomain.local-access.log" combined
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Is the redirection proper to your script or are you just redirect to your router administration panel?
By the way, if you want to do everything with ease, just take a look at Ngrok, one little line in CLI will solve your problem and it will also make it available outside of your local network!
I was boring about my large url http://localhost:8888/site/web/app_dev.php, so, I created apache virtual hosts. When I write http://site.dev in my browser, everything is working, my website appears.
The problem is that my Symfony2 website seems to be in dev / prod mode whereas I point to app_dev.php (in the .htaccess).
I have the debug bottom toolbar (it shows me "dev environment"), I can do dumps, but when I modify a file (JS, Twig, and so on), I have to execute, each time, php app/console assetic:dump (I hadn't before).
My virtual host :
<VirtualHost *:80>
ServerName site.dev
ServerAlias www.site.dev
DocumentRoot /Applications/MAMP/htdocs/bo/web
<Directory /Applications/MAMP/htdocs/bo/web>
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
</VirtualHost>
EDIT : I noticed that the website is so much faster like that (site.dev) than before (with the localhost URL). Don't know why, and still don't know how to fix the php app/console assetic:dump problem...
You need add this line DirectoryIndex app.php
<VirtualHost *:80>
ServerName site.dev
ServerAlias www.site.dev
DocumentRoot /Applications/MAMP/htdocs/bo/web
DirectoryIndex app.php
<Directory /Applications/MAMP/htdocs/bo/web>
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
</VirtualHost>
Don't you have any other problems but worrying about the lengths of the URL? :)
But seriously, try starting the internal PHP/Symfony server with the following command:
$ app/console server:start
The development version of your app will be at http://localhost:8000. Nice and short.
Based on your comment, it turns out that the actual problem you have is hardcoding URLs in your JS. The solution for that is https://github.com/FriendsOfSymfony/FOSJsRoutingBundle.
Basically, that bundle lets you expose routes to your JS so that you avoid hardcoding URLs there.
ATTN! I should mention this is all localhost. As in my machine, no servers or other jazz included.
I am really bad at configuring sites in apache, how ever I have the following config:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/image_upload_app
ServerAlias www.dev-imageuploadapp.com
<Directory /var/www/html/image_upload_app>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
And when ever I visit www.dev-imageuploadapp.com, I get a "The web page is not available" in chrome.
There are no errors in the access or the error log, after attempting to visit the page. Apache is running and the site is enabled.
The directory does exist and contains a index.php.
You need to set ip address of your site on DNS Servers. There is some free DNS Servers like https://www.cloudflare.com/. If you do in this way, you need to set delegated DNS Servers on your domain-holder site. Another try you can go to site to IP by http://{your-ip-address}/
Your browser needs to know which IP address is to use for a provided name. To enforce some values to localhost, you can add them into hosts file. Following line needs to be added:
127.0.0.1 www.dev-imageuploadapp.com
In /etc/hosts change the line:
127.0.0.1 localhost
To
127.0.0.1 localhost www.dev-imageuploadapp.com
I'm using wamp on localhost at c:\wamp\www\.
The project located under: c:\wamp\www\MyProj\public (root).
In file1.php (located in root) I have a link to some fake url (/services/.....).
I'm trying to redirect that url to other file service_router.php (in the same direction as file1.php).
I'm doing that in httpd.config:
<VirtualHost *:80>
ServerName 127.0.0.1
DocumentRoot c:\wamp\www\
<Directory "c:\wamp\www\">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/MyProj/public/services/*
RewriteRule . /MyProj/public/service_router.php
</VirtualHost>
But my WAMP refuses to restart.
What's wrong with my configurations?
Can I make a few suggestions.
If you want to use Virtual Hosts, and I consider that a very good idea. You need first to make sure that localhost still works and secondly it is a good idea to move you actual projects out of the \wamp\ folder structure.
So this would be a good starting point for your first ( of many ) VHOSTS
First create a new folder structure somewhere on any of your drives for example
C:\websites\project1\www
Now copy your project to the www folder.
Now setup the vhosts
# must be first VHOST so the that localhost and the wamp menu page still work
# Also makes this the default site so any randon hacks on your ip address
# will come here and hopefully be rejected because it only 'Allows' access
# from this machine ( see Allow Deny )
<VirtualHost *:80>
DocumentRoot "D:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "C:/wamp/www">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/websites/project1/www"
ServerName project1.dev
ServerAlias www.dqsc.old
Options Indexes FollowSymLinks Includes ExecCGI
<Directory "C:/websites/project1/www">
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Unless you actually want to make this site available to the World can I suggest that you dont use Allow from all.
Try using or the second Allow line if you want to see your site from any machine on your internal network, just use the first 3 of the 4 quartiles of your ip address and it will allow access from any ip starting with those 3 quartiles.
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
Allow from 192.168.0
Now you need to amend your HOSTS file so that windows knows about your new domain name.
Edit c:\windows\system32\drivers\etc\hosts and add the new site name project1.dev like so, you will have to launch your editor 'Run as Administrator' as this file is protected by windows :-
127.0.0.1 project1.dev
Now restart the "DNS Client" service to refresh the windows dns cache so it see's your new domain name. Start a command window, again "Run as Administrator".
net stop "DNS Client"
net start "DNS Client"
You should now be able to enter http://project1.dev in a browser and it will find you new site.
Finally, once you test that your site is working, put the url rewrite coding in a .htaccess file in the root of your new project.
C:\websites\www\project1\.htaccess
I have a Virtual Host in my machine with this configuration:
<VirtualHost 127.0.0.1:80>
ServerName codigos
DocumentRoot /home/code/codigos/app/webroot
SetEnv APPLICATION_ENV "development"
<Directory /home/code/codigos/app/webroot >
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Ok, that works nice when I type this in my browser: codigos/some_path and 127.0.0.1/some_path
But now I'm working with PayPal and I need a url for the IPN. I know that I cant' put localhost in the url, so I suppose that it would be something like this: my.dynamic.ip/some_path/ipn.php ... and thats my problem, I don't know how to configure my apache file to achieve this.
Thanks.
Register at http://www.noip.com/ (or any other dynamic dns site)
Set up their software so that you was possible to ping blabla.noip.com host (or whatever host you've got after the registration and setting up process) and see it resolves to your ip (you can check it with my ip in google)
After that put the given hostname blabla.noip.com to the ServerName or (better) ServerAlias directive
After that you'll be able to access to your virtual host from outside (assuming your firewall doesn't reject connections and you have white IP address)