I want to access my virtual host using my phone or my other computer the problem is I cannot access my site using the server name I can only access the site using the IP address of the server. I changed the port to 7777
When I tried www.tbs.com:7777/index.php I am getting "site cannot be reached"
Virtual Host Config:
<VirtualHost *:7777>
DocumentRoot "c:/xampp/htdocs/TBSApp"
ServerName www.tbs.com
ServerAlias tbs.com
ServerAdmin webmaster#localhost
<Directory "c:/xampp/htdocs/TBSApp">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
order allow,deny
allow from all
</Directory>
</VirtualHost>
Host Config
192.168.120.9 www.tbs.com
You need to use the ip address instead of the domain as it is a local host configuration. To use the domain across all devices you need to setup a DNS server.
Related
I want to access my website via virtual host from the internet. For now, I am using the public IP address of my server to access my website. Here is what I am using (please see below).
http://122.4.195.12:7777/site/index.php
Is there a way to access my virtual host from the internet? When I am accessing my virtual host from my internet (https://mysite/site/index.php) I am getting
DNS_PROBE_FINISHED_NXDOMAIN error
mysite’s server IP address could not be found.
Is there a way to add a SSL when accessing my website via public IP address? When I change http into https I am getting
ERR_SSL_PROTOCOL_ERROR
122.4.195.12 sent an invalid response.
http://122.4.195.12:7777/site/index.php -> https://122.4.195.12:7777/site/index.php
Here is my Virtual Host Config:
<VirtualHost *:7777>
DocumentRoot "C:\xampp\htdocs"
ServerName mysite
<Directory "C:\xampp\htdocs">
Require all granted
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "C:/xampp/htdocs"
ServerName mysite
SSLEngine on
SSLCertificateFile "crt/scratchitsite/server.crt"
SSLCertificateKeyFile "crt/mysite/server.key"
<Directory "C:\xampp\htdocs">
Require all granted
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Here is the host file of my server:
127.0.0.1 mysite
For question 1
The easier way will still be registering a domain name, point it to your IP address, and setup your VirtualHost ServerName for it
The VirtualHost actually detecting the Host HTTP Header from server site, so the key thing here is:
How to make the client browser send the Host header the same with you defined on server
For example, by using CURL you can force it to use the user definied Host header like this: curl -H 'Host: mysite' 122.4.195.12:7777/site/index.php
If you're using Chrome, you can try to use a browser extension, like this
For question 2
You've enabled HTTPS on port 443 instead of 7777 in your Apache configuration
Which means you should access your HTTPS service like this https://122.4.195.12:443/site/index.php instead of this https://122.4.195.12:7777/site/index.php
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.
I am having problem to access my website using ip from a different pc. For example, the ip that I want to access is 192.168.0.150/season_pass. If I use that ip, the page could not be found but if I just enter 192.168.0.150, it can access the web page. Supposedly 192.168.0.150 should redirect to the dashboard page.
Below are the https-vhosts.conf file that I edit,
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\season_pass\public"
ServerAdmin admin#localhost
ServerName season_pass
<Directory "C:\xampp\htdocs\season_pass\public">
AllowOverride All
Options Indexes FollowSymLinks
Require local
Require all granted
</Directory>
</VirtualHost>
The hosts file,
127.0.0.1 season_pass
::1 season_pass
For the apache, I am using xampp and the development is on laravel framework.
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 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)