This is on Mac OS X El Captain
I am trying to deploy a web application built in Angularjs on Apache web server.
The folder is created in /Users/username/Sites/7MinutesWorkout
For the same in order to enable virtual host, i uncommented the below line from httpd.conf
Include /private/etc/apache2/extra/httpd-vhosts.conf
Also in httpd-vhosts.conf, included the below snippet
<VirtualHost *:80>
DocumentRoot "/Users/<username>/Sites/7MinutesWorkout"
ServerName 7MinutesWorkout.com
ServerAlias www.7MinutesWorkout.com
ServerAdmin <username>#dummy.com
ErrorLog "/private/var/log/apache2/7MinutesWorkout.com_error_log"
CustomLog "/private/var/log/apache2/7MinutesWorkout.com_access_log" common
<Directory>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Also made entry in /etc/hosts as
127.0.0.1 7MinutesWorkout.com
127.0.0.1 www.7MinutesWorkout.com
Restarted apache by the command sudo apachectl restart
But when i try to access the site, i get the error page, this site cannot be reached.
On executing the command
apachectl configtest
gives the output as AH00526: Syntax error on line 47 of /private/etc/apache2/extra/httpd-vhosts.conf:
Directory directive requires additional arguments
There is only one entry as of now in the httpd-vhosts.conf as specified above.
Please suggest
I think your issue is with the Require all granted which needs to be present.
Here is the relevant part of my config, which works
<Directory>
Options Indexes FollowSymLinks
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
# onlineoffline tag - don't remove
Order Allow,Deny
Allow from all
# Allow from 127.0.0.1
# Allow from ::1
# Allow from localhost
</Directory>
Related
How to make prestashop to use prestashop.conf file which is a clone of 000.default.conf on my local server?
When I disable 000-default.conf, prestashop don't load.
When I enable that back, the web-page loads normally.
I've enabled prestashop.conf and reloaded/restarted Apache.
I use Apache2, prestashop 1.6.1, OS is Linux Mint.
Maybe someone can give me advice what else should I change. I haven't found solution so far.
P.S. prestashop.conf is complete clone of 000-default.conf.
Have you changed the paths to match these of your website?
<VirtualHost *:80>
ServerAdmin youradminlogin#yourwebsite.com
DocumentRoot "path/of/your/website"
ServerName website-name.com
Options All Indexes FollowSymLinks
<Directory "path/of/your/website">
DirectoryIndex index.html
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require local
</Directory>
</VirtualHost>
Make shure it is in /etc/apache2/sites-enabled/ !
After modifying this, you'll need to restart the server (sudo apachectl restart)
I develop projects that I've located in /home/user/projects directory. This directory is chmod 777. The problem is that I'm always getting Error 403 Forbidden when I try to access this directory or any subdirectory. This is how my /etc/apache2/sites-available/000-default.conf looks like:
<VirtualHost *:80>
ServerName localhost
ServerAdmin user#user.com
DocumentRoot /home/user/projects
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Options +FollowSymLinks
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /home/gtakacs/projects>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>
What's wrong with this? When I used /var/www as my document root, everything worked.
EDIT : try doing chmod -R 777 /home to make sure all your home is available (note that this solution is NOT RECOMENDED, having your project in /var/www would definitely be a better solution in my opinion)
(Can't comment so post reply)
Isn't there a config file in your project where you're supposed to set who can access the app? Check if you didn't forget to add your ip adress and domain name in this file.
When using Apache2 with Django framework (python), I had the same error, and it was because I forgot to add the domain name to authorized hosts.
You can also check access.log and error.log to have more detailed informations on what caused the error.
Command out:
#Order allow,deny
I had this issue before, the problem might be that your document root does not contain the described directories.
I updated my ubuntu lately, I wanted to program in my Ubuntu 13.10, and was setting up apache2, and every time I run the command:
sudo a2ensite default
I get the following error:
Error default site does not exist
how can I fix this issue?
To fix this and any other virtual host running on apache 2.4 I needed to set the
default (and any other virtual host you have)
as
default.conf (add .conf any virtual host you have already set)
Enter the console (terminal) and type the following commands:
sudo mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.conf
sudo a2ensite default
And we will get the following:
Enabling site default. To activate the new configuration, I needed to run: service apache2 reload
now run:
service apache2 reload
and done.
or create the default.conf file if you don't have it and this is what it should contain by default:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
The simple way of doing it is adding your .conf file or your virtual host configurations to the site-available folder and then when in the folder and then try again. Worked for me.
I had the same problem, so I tried changing my virtual host configuration file name from default to default.conf, as mentioned here, and it was still not working.
At last i got it. It is necessary also to change the code:
Order allow,deny
Allow from all
to
Require all granted
http://httpd.apache.org/docs/2.4/upgrading.html
After that, I've restarted apache and it worked again
All of my vhosts are being sunk into the first available webroot and not their assigned webroot except for my second which is just going wild.
if I try and access ipv6mailer.com I watch the hit live go ->
[error] [client 24.184.110.39] script not found or unable to stat: /home/downlowd/www/login-form.php
True, that file does 'not' exist. it should be looking in /home/ipv6mailer/www
I have 3 vhosts and two are going to /home/downlwd/www and ignoring ServerName completely.
If I comment our downlowd.com, the log output try to access ipv6mailer.com looks like ->
[Wed Aug 21 15:23:12 2013] [crit] [client 24.184.110.39] (13)Permission denied: /home/wemail1/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
It's going to the 'new' default and not ServerName
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#<IfDefine DEFAULT_VHOST>
# see bug #178966 why this is in here
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
# Use name-based virtual hosting.
NameVirtualHost *:80
# When virtual hosts are enabled, the main host defined in the default
# httpd.conf configuration will go away. We redefine it here so that it is
# still available.
#
# If you disable this vhost by removing -D DEFAULT_VHOST from
# /etc/conf.d/apache2, the first defined virtual host elsewhere will be
# the default.
# vim: ts=4 filetype=apache
<VirtualHost *:80>
ServerName www.downlowd.com
ServerAlias downlowd.com *.downlowd.com
ServerPath /downlowd.com
DocumentRoot /home/downlowd/www
<Directory "/home/downlowd/www">
Options Indexes FollowSymLinks MultiViews ExecCGI Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
AddHandler cgi-script .php .php4 .php3
<VirtualHost *:80>
ServerName www.wemail1.com
ServerAlias wemail1.com *.wemail1.com
ServerPath /wemail1.com
DocumentRoot /home/wemail1/www
<Directory "/home/wemail1/www">
Options Indexes FollowSymLinks MultiViews ExecCGI Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.ipv6mailer.com
ServerAlias ipv6mailer *.ipv6mailer.com
ServerPath /ipv6mailer
DocumentRoot /home/ipv6mailer/www
<Directory "/home/ipv6mailer/www">
Options Indexes FollowSymLinks MultiViews ExecCGI Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
dev-box-201 www # /usr/sbin/apache2 -S
apache2: Could not reliably determine the server's fully qualified domain name, using dev-box-201.nyctelecomm.com for ServerName
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server www.downlowd.com (/etc/apache2/vhosts.d/00_default_vhost.conf:42)
port 80 namevhost www.downlowd.com (/etc/apache2/vhosts.d/00_default_vhost.conf:42)
port 80 namevhost www.wemail1.com (/etc/apache2/vhosts.d/00_default_vhost.conf:58)
port 80 namevhost www.ipv6mailer.com (/etc/apache2/vhosts.d/00_default_vhost.conf:71)
Syntax OK
The user apache is running as (www-data?) needs search permission (+x on a dir) for every path between / and the file you're serving, if that directory has an effective value of AllowOverride != none (IOW, if Apache is configured to look for htaccess there).
I have tried the following VIrtual Host entry which I adapted from this question about cgi's and mod_perl, expecting it would work for me but it doesn't.
I have disabled mod_perl in my http.conf expecting this Virtual Host entry would override it. I don't want any other sites on my server running with mod_perl at the moment...
May be my question is how to disable modperl for everything else, and enable it just for one directory.
I now get the apache2 server error: Invalid command 'PerlModule', perhaps misspelled or defined by a module not included in the server configuration when restarting apache2 with this:
<VirtualHost *>
ServerAdmin me#someserver.com
ServerAlias some_server.com
DocumentRoot /www/some_dir
#mod_perl stuff:
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
PerlModule Apache2::RequestRec
<Directory /www/some_dir>
Options Indexes ExecCGI FollowSymLinks MultiViews
#mod perl stuff:
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
PerlOptions +SetupEnv
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /logs/some_error.log
# Possible values include: debug, info, notice, warn, error, crit,alert, emerg.
LogLevel warn
CustomLog /logs/some_access.log combined
ServerSignature On
</VirtualHost>