So i have a website in which there is a form where users fill their details and we have a functionality where the users subsite will gets automatically created for them.
For example, user registers with newres as his username then we create a subsite for them on newres.crm.nadsoftpro.info.
We are using apache server. The general functionality is we dynamically create a virtual host entry through php. We then also create a directory for them in the /var/www/html/ folder dynamically. We then enable the site in the back end and restart the server automatically through cron, so newly added subsite can run without doing manual server restart.
The problem is sometime the subsite gets creates without any issues and loads smoothly. But sometime it does not load. I can see the virtual host is there, directory is there in html folder but when i hit the url in the browser, it just shows the blank page. (Screenshot: https://www.screencast.com/t/y2z41cr4tVVm). While other website is loading correctly through the same script: http://gaurav.crm.nadsoftpro.info.
Here is the virtual host entry for this:
<VirtualHost *:80>
UseCanonicalName Off
ServerName newres.crm.nadsoftpro.info
ServerAlias newres.crm.nadsoftpro.info
VirtualDocumentRoot /var/www/html/newres.crm.nadsoftpro.info
<Directory /var/www/html/newres.crm.nadsoftpro.info/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Can someone please help me to figure out what i am missing?
Thank you.
Related
I have a Ubuntu server with 2 websites on it. I can navigate to one, but not to the other. Here are the details:
Each website has a user with the same name as the group and as the subfolder. Sites are hosted under
/home/site1/public_html and
/home/site2/public_html
Now in my case site1 is called from a subdomain, but it works just fine, so if I navigate to site1.mydomain.com it opens up the CodeIgniter page and I can navigate with no issues (I have .htaccess here to get rid of index.php in the url).
However when I try to navigate to www.site2.com which points to /home/site2/public_html it gives me a 404 error. So to troubleshoot, I added a /home/site2/public_html/index.html simple file and I can see that if I navigate to www.site2.com, however I can't see it if I navigate to www.site2.com/index.html. Also, in my case, I have a subfolder (with same name as the site = "site2") where CodeIgniter code/folder structure is and I just can't get tot that index.php from code igniter at all (path to it is /home/site2/public_html/site2/index.php). I tried to navigate as www.site2.com/site2/index.php or www.site2.com/index.php with or without htaccess file but with no help. I tried to remove the .htaccess in this site, I tried to create a test.html in /home/site2/public_html/site2 but I can't navigate to it, I get 404 if I do www.site2.com/site2/test.html
in terms of user access I used $ chmod -R 755 /home/site2
Is it an access right that I am missing? Or a conflict with the other .htaccess from the other virtual folder? No clue... and I am just running out of ideas
V Host Settings
ServerName site1.mydomain.com
ServerAlias site1.mydomain.com
DocumentRoot "/home/site1/public_html"
<Directory "/home/site1/public_html">
AllowOverride All
allow from all
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
and for the one I've trouble with
ServerName www.site2.com
ServerAlias www.site2.com
DocumentRoot "/home/site2/public_html"
<Directory "/home/site2/public_html">
AllowOverride All
allow from all
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
NOTE : I just made a subdomain site2.mydomain.com (domain registered with FatCow) and that seems to be working, it does not work only when I call it with www.site2.com (register under GoDaddy - which gives a GoDaddy "Destination unknown" page which I assumed it is a 404 error and always asks me to Accept cookies ... and I am on a diet :P )
Thanks anyone in advance!
oh darn thing, you were right #sintakonte, one site was pointing somewhere else. Go daddy had a A record with old IP address, I added another A record and asked them to park the original (as I had no rights to do so from their website). And problem got resolved. Thank you!
I developed an application with laravel and i put it in a local server and i need that other computer access it.
I think that have 2 solutions:
First: Access to laravel server (port 8000)
Second: Put the project in xampp
What is the best solution?
With the first option i can't access and with xampp it doesn't access well to routes and doesn't load the css and js files.
If i access to root folder it list the project folders and i have to go to public folder but doesn't load stylesheet files.
How can i do that?
UPDATE:
I did this steps and this not work yet.
In httpd.conf enable this line Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
Next i add a host in in hosts file:
127.0.0.1 arquivo.localhost
Next i'm going to httpd-vhosts.conf and add this:
<VirtualHost *:8888>
DocumentRoot "/Applications/MAMP/htdocs/arquivo/public"
ServerAdmin arquivo.localhost
<Directory "/Applications/MAMP/htdocs/arquivo/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Next i restart the apache and when i try to access to http://arquivo.localhost this give me This site can’t be reached
What i'm doing wrong?
Thank you
create virtualhost under xampp/apache/conf/extra/httpd-vhost.conf
like this
<VirtualHost *:80>
ServerAdmin webmaster#localhost.com
DocumentRoot "C:/xampp/htdocs/laravel/public"
ServerName laravel.localhost
ErrorLog "logs/laravel-error.log"
CustomLog "logs/laravel-access.log" common
</VirtualHost>
and access with http://laravel.localhost/
If its working fine on your localhost, other person can access your site using your Ip address, provided you both are on same local network.
For more you can see this reference : Accessing localhost (xampp) from another computer over LAN network - how to?
I am trying to setup virtual host for Magento, but its not working, I created magento.localhost.com.conf in the Apache2/sites-avaliable directory, this is my file :
<VirtualHost *:80>
ServerAdmin magento#localhost.com
ServerName magento.localhost.com
DocumentRoot /srv/www/magento_dev/public_html
<Directory /srv/www/magento_dev/public_html/>
Options Indexes FollowSymlinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /srv/www/magento_dev/logs/error.log
LogLevel warn
</VirtualHost>
I am following instructions from book actually ,also changed /etc/hosts file , I added 192.168.36.1 magento.localhost.com. at the end , but when I try to open the site, it says :
This webpage is not available
I enabled apache rewrite, give permission to all this folders ,basically did everything as instructions, but still not working. My os is Ubuntu 14.04, any tips ?
Follow recommendations in comments for a2ensite and for testing with a simple index.php file.
Also make sure to restart Apache.
When that works, then try with the Magento index.php file.
What you do next depends on if this is a brand new copy of Magento or a copy of a previously installed one. If it's new, you should see the setup page. Follow the instructions. If it's a copy, you will need to change the database core_config_data values relating to your website urls.
Edit:
You say
changed /etc/hosts file ,I added 192.168.36.1
On what machine did you change this? Also is your Magento running in a virtual machine on your Windows machine? And the VM machine has that IP?
Edit 2:
Also change your web server name to "Magento.mysite.com" or something like that. localhost has a special meaning! And it doesn't make sense if you are accessing a remote we server!
Check web server ip with ipconfig or ifconfig on the command prompt. Put that ip in the hosts file of the web browser machine.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 months ago.
Improve this question
I need your help here in creating a virtual host in wampserver. In office I can create a virtual hosts but when I try to create in my laptop it doesn't work. I still can't figure out what's wrong. Here's what I did.
I copy the wordpress file in this folder. This will be the path of my project
E:\Subversion\chelle.wpblog.local
I edit the host file
C:\Windows\System32\drivers\etc\hosts
I added it to the end of file
127.0.0.1 chelle.wpblog.local
Next is I enable the virtual host in Apache
C:\wamp\bin\apache\Apache2.4.4\conf\httpd.conf
I uncomment this
Include conf/extra/httpd-vhosts.conf
Next is I setup the virtual host in WAMP
C:\wamp\bin\apache\Apache2.4.4\conf\extra\httpd-vhosts.conf
I add this at the bottom
<VirtualHost *:80>
ServerName chelle.wpblog.local
ServerAlias chelle.wpblog.local
DocumentRoot "E:/Subversion/chelle.wpblog.local/"
<Directory "E:/Subversion/chelle.wpblog.local/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Last is restart wampserver and open the chelle.wpblog.local in the browser. And it doesn't display. It display only google search results.
I was installing the zend framework on my local wamp using apache server.
First go and decide what will be your domain name for the local url.
Ex->www.test_zend_tutorial.com
then go and open the file located at "C:\WINDOWS\system32\drivers\etc"
hosts
write
127.0.0.1 (use one tab space) www.test_zend_tutorial.com
then go to the folder located at
D:\wamp\bin\apache\Apache2.2.17 (whatever is your version) \conf\
and open the file
httpd.conf
and search for text
Include conf/extra/httpd-vhosts.conf
and uncomment it by removing the # tag from the start of the line.Save the file and close it.
Now go to another folder located at
D:\wamp\bin\apache\Apache2.2.17\conf\extra
and open the file
httpd-vhosts.conf
and paste the code below at the last in this file
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "D:\wamp\www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName www.test_zend_tutorial.com
DocumentRoot "D:\wamp\www\(your project folder name)\public"
SetEnv APPLICATION_ENV "development"
<directory "D:\wamp\www\(your project folder name)\public">
DirectoryIndex index.php
AllowOverride all
Order Allow,Deny
Allow from all
</directory>
</VirtualHost>
and restart the wamp, now write the www.test_zend_tutorial.com in the browser and you will see the things working.
If when you use the new domain in the browser it goes to a google search or something like that then the change to your hosts file has not been recognised.
You have to either reboot after changing the hosts file or more simply run these 2 commands from a command windows ( as administrator )
net stop dnscache
net start dnscache
This will refresh windows DNS cache and pick up your hosts file changes.
It is also a good idea to ping your new domain to check it is being seen, use
ping chelle.wpblog.local
If it reports 127.0.0.1 as the ip address and 4 send and 4 receieved packet then the domain is now known to Windows, if it reports some other ip address the hosts file change has not succeeded.
Also it is a good idea when creating VHOSTS to also create one for localhost or the wamp home page will not work.
You also have old Apache 2.2 syntax (Order allow,deny allow from all) you could try using the Apache 2.4 syntax, see below
So try this
## must be first so the the wamp menu page loads
<VirtualHost *:80>
ServerAdmin webmaster#mail.net
DocumentRoot "D:/wamp/www"
ServerName localhost
<Directory "D:/wamp/www">
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#mail.net
ServerName chelle.wpblog.local
ServerAlias www.chelle.wpblog.local
DocumentRoot "E:/Subversion/chelle.wpblog.local"
<Directory "E:/Subversion/chelle.wpblog.local">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
In WampServer 3.0.4 you do not need to run through all those setting up.
Go to local host and under Tools area for "Add a Vertual Host" in the first time it will say turn on "Vertual Host sub menu" in wamp server settings.
To get there right click on wamp icon > go to wamp server settings > and click on Vertual Host sub menu. Then re-fresh the page and follow the setup process, you just need to provide the server name and path. It will do all the works for you.
Simple as that
Method 1:
in hosts file
127.0.0.1 mysite
::1 mysite
in C:\wamp64\bin\apache\apache2.4.23\conf\extra\httpd-vosts.conf file add your virtual host as follows
<VirtualHost *:80>
ServerName mysite
DocumentRoot "<path_to_your_local_site>"
<Directory "<path_to_your_local_site>">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Make sure vhost configuration is enable in httpd.conf file is enabled as follows
C:\wamp64\bin\apache\apache2.4.23\conf\httpd.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
After you have changed configuration as above, restart all service in wamp and load website as follows
http://mysite
your local site should open.
Method 2:
In latest versions of wamp, you can do this configuration via webpage.
Open localhost in your browser. You would see wamp welcome page.
Down below under Tools, there is option to add virtual host. click on the link which would take you to add virtual host page.
In Name of the host, enter your site name eg: mysite
Under Complete absolute path of the VirtualHost folder, enter the path of your site.
Save the config and restart all services. you should be able to open mysite with the link http://mysite
As pointed in another answer, in newer versions of wam
The answers above are overcomplicating the problem somewhat, and in fact the question is including extra information that's misleading the responders.
The clues lie in step 2 and the symptoms described in 5. The hosts file is set up but when the request is made to "blah.local", google responds. Apache is not involved.
The first step to diagnosis would be pinging blah.local and seeing that it maps correctly to 127.0.0.1. I have never (in many years as a developer) found it necessary to restart local DNS on either Windows or Linux/Mac so I would expect this to work out of the box. But if it doesn't, of course restart DNS and see that it does.
However, late versions of Chrome at least do not recognize the TLD '.local' and so when you put the URL back in the browser, it's passed on to Google as a search term. There may be a setting in your browser to tell it to handle the unsanctioned TLD, but your simplest solution would be to use a TLD that's sanctioned by W3C like '.com'.
In short, if your hosts file reads something like
127.0.0.1 local.chelle.wpblog.com
rather than
127.0.0.1 chelle.wpblog.local
everything should work.
Create the folder for your local website
Go to localhost (browser)
Click Add a Virtual Host button
Add the name of the virtual host
Add the complete absolute path
Restart DNS
I am trying to set up a virtual host so that I can run my .php file from Eclipse as a web page.
I follow the instructions from this discussion:
Make XAMPP/Apache serve file outside of htdocs
Scroll down to virtual hosts and the instruction is basically
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "/Users/Oky/Documents/eclipse/firstEclipseProject/"
ServerName firstEclipseProject.localhost
ErrorLog "/Users/Oky/Documents/eclipse/firstEclipseProject/logs/error_log"
<Directory /Users/Oky/Documents/eclipse/firstEclipseProject/>
Order allow,deny
Allow from all
</Directory>
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
The document is at /Application/XAMPP/etc/extra/httpd-vhosts.conf
Then I change the hosts file at /private/etc/hosts and at the bottom, I added
127.0.0.1 firstEclipseProject.localhost #firstEclipseProject
So, I think I am doing it right up to this point because when I fire my browser and point to firsteclipseproject.localhost, it redirects me to
firsteclipseproject.localhost/XAMPP/
which is the main XAMPP web page. It does not return an object/page not found which means the redirecting is somewhat working.
So, in /Users/Oky/Documents/eclipse/firstEclipseProject/
I created a php file called HelloWorld.php but when I point to firsteclipseproject.localhost/HelloWorld.php, it says object not found! I also tried firsteclipseproject.localhost/XAMPP/HelloWorld.php and it fails.
Any help is appreciated! Thanks!!!
I would suggest you leave the root directory the way it is and instead setup an Alias to your eclipse directory.
Did you restart apache after making config changes?