Windows XAMPP issue: The site ahead contains malware - php

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

Related

Symfony project shows directory listing index instead of index page

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>

Apache2 Alias working locally but not working for sub directory on another server

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.

Object Not Found Error on XAMPP virtual hosts

I'm trying to setup virtual hosts on my localhost, below are the things that I've done:
Enable Virtual Hosts
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Created Virtual Hosts
# localhost
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
# Pendu Web
<VirtualHost *:80>
ServerName local.mysite
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/mysite”
<Directory "/Applications/XAMPP/xamppfiles/htdocs/mysite">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/mysite.local-error_log"
</VirtualHost>
Edit Hosts File
# XAMPP VirtualHost mappings
127.0.0.1 local.mysite
Now, when trying to access local.mysite from browser url, gives back Error 404: Object Not Found. When checking apache error log, the error is Warning: DocumentRoot [/Applications/XAMPP/xamppfiles/htdocs/mysite\xe2\x80\x9d] does not exist. Not really sure what I'm missing here.
The problem was caused by this DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/mysite”, the closing double ( ” ) quotation mark, updated it to ( " ).

Subdomain, virtual host XAMPP

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).

Serve documents from alternative document root

I would like Apache to serve documents from c:/Apache24/htdocs and d:/www resp on my Windows local machine. In httpd-vhosts.conf I'm trying:
<VirtualHost *:80>
DocumentRoot "c:/Apache24/htdocs"
ServerName test.localhost
Options Indexes FollowSymLinks
<Directory "D:/www">
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
and in hosts
127.0.0.1 test.localhost
but browsing to http://test.localhost results in a list of directories under C:/htdocs being displayed?
Am I getting any closer with this:
Alias c:/Apache24/htdocs D:/www
<Directory c:/Apache24/htdocs>
Require all granted
</Directory>
If so, where do I add it? N.B. I want to store and serve web documents from D:/ since C:/ is getting rather full now.
check you have row: NameVirtualHost *:80 before your virtual host. That should usually be there already, but check it.
Change your host to point just into one folder like:
<VirtualHost *:80>
DocumentRoot "D:/www"
ServerName localserver
Options Indexes FollowSymLinks
<Directory "D:/www">
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
Create symbolic link from your c:/Apache24/htdocs to for example D:/www/apache folder.
Then you can access to your c:/Apache24/htdocs folder from url:
localserver/apache
Read more about symlinks:
http://en.wikipedia.org/wiki/NTFS_symbolic_link
Another option is to create two urls (domains) and virtualhosts like (add this after above):
<VirtualHost *:80>
DocumentRoot "c:/Apache24/htdocs"
ServerName other.localserver
Options Indexes FollowSymLinks
<Directory "c:/Apache24/htdocs">
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
and in your hosts:
127.0.0.1 localserver other.localserver
On Windows 7 with WAMP installed on C:\Apache24 and serving documents out of C:\Apache24\htdocs you may want to serve documents from the D drive instead, since C is getting full. Go to: C:\Apache24\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "D:/www/apache/site1"
ServerName site1.dev
<Directory "D:/www/apache/site1">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/www/apache/site2"
ServerName site2.dev
<Directory "D:/www/apache/site2">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
And edit: C:\Windows\System32\drivers\etc\hosts
127.0.0.1 site1.dev
127.0.0.1 site2.dev
You should now be able to serve (locally) you're web documents from D:\www\apache with no need for sym links.

Categories