Hey guys I have a lamp setup in a virtual-box (running Ubuntu-server 12.04 with apache2.2 and php5.3.10). I have a virtual host file which looks like this.
<VirtualHost *:80>
ServerAdmin admin#demosite.com
ServerName demosite.dev
ServerAlias www.demosite.dev
DocumentRoot /var/www/demosite
<Directory /var/www/demosite>
Options Indexes FollowSymLinks MultiViews
AllowOverride ALL
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/bfhosting.log
LogLevel debug
</VirtualHost>
I have an index.php file in /var/www/index.php and the server runs that file fine. But it's not running any php code that's inside my other website's folder i.e /var/www/demosite.
Related
I am new to Symfony, and I've just created a new project on Windows server + Php7.3 + Apache 2.4.
The project folder is located at C:\Apache24\htdocs\symfony.
When I access that folder from my web browser, I see the directory listing page it should show the index page in the public folder.
Here is my code in apache:
<VirtualHost *:90>
ServerAdmin abc#abc.com
DocumentRoot "${SRVROOT}/htdocs/"
ServerName localhost
<Directory "${SRVROOT}/htdocs/symfony/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
And i tried to use .htacess option as in Symfony guideline with install symfony/apache-pack, but no luck:
<VirtualHost *:90>
ServerAdmin abc#abc.com
DocumentRoot "${SRVROOT}/htdocs/"
ServerName localhost
<Directory "${SRVROOT}/htdocs/symfony/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
the .htaccess file had been created in public folder.
i have tried to install the demo application too, the same issue.
Wordpress or other applications have been installed without issue.
Thank you.
Shouldn't the DocumentRoot also be pointing to the Symfony public directory?
<VirtualHost *:90>
ServerAdmin abc#abc.com
DocumentRoot "${SRVROOT}/htdocs/symfony/public"
ServerName localhost
<Directory "${SRVROOT}/htdocs/symfony/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I have the same configuration and set up only the versions of Apache2 are slightly different. I have set up /api to load the /public.
So, locally (apache 2.4.18)
mysite.local correctly loads /var/www/mysite/application
mysite.local/api correctly loads /var/www/mysite/public
mysite.local/api/subdirectory correctly loads /var/www/mysite/public
I want to replicate this on a hosted dev server (Apache 2.4.7) however I am getting the following:
mysite.devserver.com correctly loads /var/www/html/mysite/application
mysite.devserver.com/api correctly loads /var/www/html/mysite/public
mysite.devserver.com/api/subdirectory incorrectly loads /var/www/html/mysite/application
Local mysite.conf file (working)
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName mysite.local
ServerAlias www.mysite.local
Alias /api /var/www/mysite/public
<Directory /var/www/mysite/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
</Directory>
DocumentRoot /var/www/mysite/application
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Dev server conf file (not working)
<VirtualHost *:80>
ServerName mysite.devserver.com
ServerAdmin webmaster#localhost
Alias /api /var/www/html/mysite/public
<Directory /var/www/html/mysite>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
</Directory>
DocumentRoot /var/www/html/mysite/application
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I have also tried to add the Alias into mods-enabled but its not making a difference. The code is the exact same, same .htaccess files in both instances.
I am just setting up virtualhost in xampp on windows. I edit the file D:\xampp\apache\conf\extra\httpd-vhosts.conf and add this
<VirtualHost *:80>
ServerAdmin webmaster#localhost.myproject.com
DocumentRoot "D:\virtualdomain\MyProject"
SetEnv APPLICATION_ENV development
<Directory "D:\virtualdomain\MyProject">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ServerName localhost.myproject.com
ErrorLog "localhost.myproject.com"
CustomLog "localhost.myproject.com" common
</VirtualHost>
Then i edit the file C:\Windows\System32\drivers\etc\hosts and add this
127.0.0.1 localhost.myproject.com
Inside the directory D:\virtualdomain\MyProject i created one file index.php. But when i am trying to access the http://localhost.myproject.com/index.php, It will give me this error page
I have set 3 virtual hosts on an AWS Linux AMI instance, HTML files are working file but the PHP files are outputting plain text.
Before I set up the vhosts I tested the PHP files and they were running fine.
I followed these instructions to install the LAMP stack on my instance:
AWS Install LAMP
I have put the vhosts in the /etc/httpd/conf/httpd.conf file, and they look something like this:
<VirtualHost *:80>
ServerName domain1.com
DocumentRoot /var/www/html/domain1
<Directory /var/www/html/domain1>
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName domain2.com
DocumentRoot /var/www/html/domain2
<Directory /var/www/html/domain2>
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName domain3.com
DocumentRoot /var/www/html/domain3
<Directory /var/www/html/domain3>
AllowOverride All
</Directory>
</VirtualHost>
I tried adding this to httpd.conf
AddType application/x-httpd-php .php
but this makes turns the plain text PHP files into downloadable PHP files
Have I been missing something obvious all along?
Looking for some help with setting up a subdomain in XAMPP.
I've read a few articles, whilst they seem to be all related to local installs, what I have is a PORTABLE version of XAMPP so there is no drive prefix.
I tried some of the mentioned articles below but none seem to work. They all display a server not responding or end up going to google to search.
I have in httpd.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Then in extra/httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *>
ServerAdmin admin#localhost.com
ServerName localhost
ServerAlias localhost
DocumentRoot "/xampp/htdocs/public"
<Directory "/xampp/htdocs/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost forums*>
ServerAdmin admin#localhost.com
ServerName forums
ServerAlias forums
DocumentRoot "/xampp/htdocs/public/forums"
<Directory "/xampp/htdocs/public/forums">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
When I do this "forums.localhost" is turns into this in chrome "http://www.forums.localhost/" and then I get:
The webpage is not available
Amongst many I have read, some mention editing windows hosts file, but given this is a PORTABLE version of XAMPP I can't always go editing the hosts file in every computer.
these were few I tried but they all fail
http://austin.passy.co/2012/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/
https://community.apachefriends.org/f/viewtopic.php?p=198815&sid=7a72729a95ed298148f8635dd414295a
how to create subdomains in apache(xampp) server?
Can someone please help me how to get subdomain to work on a PORTABLE version or how I should be doing it, or is editing windows hosts file compulsory?
not tested but try this:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin admin#localhost.com
ServerName localhost
ServerAlias localhost
DocumentRoot /xampp/htdocs/public
<Directory "/xampp/htdocs/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#localhost.com
ServerName forums
ServerAlias forums
DocumentRoot /xampp/htdocs/public/forums
<Directory "/xampp/htdocs/public/forums">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Don't forget to write
127.0.0.1 forums
to your hosts file, if you don't have a DNS-Server.
You need to add forums.localhost to your hosts file.
Edit %SystemRoot%\System32\drivers\etc\hosts and add 127.0.0.1 forums.localhost.
I don't think there is another way to do this, sorry (maybe creating a script that automatically edits the hosts file, but it's quite dirty).