I had just upgraded to Ubuntu 13.10 earlier today. The version of Apache2 is 2.4.6 now. I removed the old site config file and tried to create a new one. When I was trying to copy default.conf, I found the format had been changed significantly. And here is an example of the new conf file. As lots of people do, I also have the forbidden problem even if I set my folder permission to 777.
1 <VirtualHost *:80>
2 # The ServerName directive sets the request scheme, hostname and port th at
3 # the server uses to identify itself. This is used when creating
4 # redirection URLs. In the context of virtual hosts, the ServerName
5 # specifies what hostname must appear in the request's Host: header to
6 # match this virtual host. For the default virtual host (this file) this
7 # value is not decisive as it is used as a last resort host regardless.
8 # However, you must set it for any further virtual host explicitly.
9 ServerName www.janicezhang.me
10
11 ServerAdmin webmaster#localhost
12 DocumentRoot /home/yifan/www/janice
13
14 # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
15 # error, crit, alert, emerg.
16 # It is also possible to configure the loglevel for particular
17 # modules, e.g.
18 #LogLevel info ssl:warn
19
20 ErrorLog ${APACHE_LOG_DIR}/error.log
21 CustomLog ${APACHE_LOG_DIR}/access.log combined
22
23 # For most configuration files from conf-available/, which are
24 # enabled or disabled at a global level, it is possible to
25 # include a line for only one particular virtual host. For example the
26 # following line enables the CGI configuration for this host only
27 # after it has been globally disabled with "a2disconf".
28 #Include conf-available/serve-cgi-bin.conf
29 </VirtualHost>
I am just wondering if there is some toturial to set up virtual host for apache 2.4.6 in ubuntu 13.10. Thanks.
OK, I solved the problem by myself. Two things need to be done.
First, add lines in your site config file like this:
<Directory "/home/yifan/www/janice">
Options ExecCGI
AllowOverride all
Require all granted
</Directory>
After this, I can browse into the site without the forbidden error. However, the php file is displayed as plain text. I check the folder mods-enabled and find php5 is not here. I have no idea why php5 is lost during upgrading. So just reinstall it by
sudo apt-get install libapache2-mod-php5
Then, the site is recovered.
Related
The last time I applied updates to my Ubuntu 22.04.1 LTS it clobbered my /etc/apache2/sites-available/000-default.conf file resetting it to the default. There was a file 000-default.dpkg-old which seemed to have the old contents, so I copied that back to replace 000-default.conf. I restarted the Apache2 server, but now I get "Forbidden, you don't have permission to access this resource". I have not changed anything else
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and por...
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /home/jcobban/public_html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
I have not changed the access to the web site directory.
$ ls -ld public_html
drwxrwxr-x 26 jcobban www-data 12288 Jan 20 18:27 public_html
/etc/apache2/sites-available$ ls -l
total 16
-rw-r--r-- 1 root root 1344 Feb 18 2020 000-default.conf
-rw-r--r-- 1 root root 1286 Jan 17 22:41 000-default.conf.new
-rw-r--r-- 1 root root 6219 Jan 17 22:41 default-ssl.conf
000-default.conf.new is what I renamed the version installed by Ubuntu
Exactly what "resource" is Apache complaining about?
Hello i am trying to configure a magento site in my localhost i have to change the url from localhost/magento2 to localhost here my apache configuration
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/magento2/
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
In my database i change the url
but my site looks like this
if a click y link i get 404 not found error for example
http://localhost/women/tops-women/jackets-women.html
Can you please check if you have a .htaccess default file on pub/static location ?
If you are missing that, put one there by copying from default Magento files..
Also if check if you have enabled mod_rewrite module in apache2.
I just purchased a domain from GoDaddy, let's call it example.com. I set it up on GoDaddy to where it forwards people to my home IP Address where my Raspberry Pi hosts my website using Apache2. How can I properly set it up so that it shows example.com in the address bar rather than my home IP address?
Here is my .conf file for my website:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
If you visited the site via IP address prior to porting and setting a DNS record. You may need to clear your browser and DNS cache. This is how to flush Windows DNS via command line:
ipconfig /flushdns
Note that you MAY have to run cmd as admin.
This days I sleep with my http://localhost working, and reading pages from /var/www...
I woke up with an "AH00094" error at Apache2 log, and (Apache2 created?) a surprised /var/www/html, that Apache2 try to use.
Now my http://localhost/anything not works (error 404 at browser).
How to fix it? I need back my http://localhost working with files at /var/www!
Context
I am using Ubuntu12 with Apache2, all default and standard.
I checked out error log by tail /var/log/apache2/error.log in order to find out exact path that Apache, that shows
... [core:notice] [pid 1597] AH00094: Command line: '/usr/sbin/apache2'
... [:error] [pid 1604] [client 127.0.0.1:40624] script '/var/www/html/info.php' not found or unable to stat
The folder /var/www/html is new, all, like '/var/www/info.php', are at /var/www, not at /var/www/html.
I fixed the "AH00094" error editing
sudo nano /etc/apache2/apache2.conf
and adding at last line
ServerName localhost
(now no log errors about localhost, but nothing works)
PS: I checked other related issues, but not is the same problem: Permissions for /var/www/html , Attempting to use symbolic link for var/www/html
I'm afraid to use the clues of this answer ... in my Ubuntu there are no the .conf indicated files. I must create it? Is secure?
As #RahilWazir suggested, here is also my "/etc/apache2/sites-available/000-default.conf",
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
See here:
Why has the apache2 www dir been moved to /var/www/html?
The default directory apparently (we were also surprised) moved from /var/www to /var/www/html for htdocs in Debian, and Ubuntu copied this change. The reasons given are somewhat sound, but the upgrade path is probably “interesting” (as in the Chinese proverb)… as you have encountered.
If you want to use /www as root folder instead of /www/html you can simply edit the apache2 config file to have /var/www
Edit 000-default.conf
sudo gedit /etc/apache2/sites-available/000-default.conf
then change
DocumentRoot /var/www/html
to
DocumentRoot /var/www
Restart apache2 server :
sudo service apache2 restart
I have a VPS with a website (www.domain1.com) smoothly running on it (Ubuntu 10.04, Apache 2.2, RoR, Passenger, mysql). I now need to get a second website running (www.domain2.com). But the website is not displayed after I did all the setup.
I added in apache2/sites-enabled/domain2.com
<VirtualHost *:80>
ServerAdmin email#test.com
ServerName www.domain2.com
ServerAlias domain2.com
DirectoryIndex index.html
DocumentRoot /home/user/public_html/domain2.com/current/public
LogLevel debug
ErrorLog /home/user/public_html/domain2.com/current/log/error.log
CustomLog /home/user/public_html/domain2.com/current/log/access.log combined
</VirtualHost>
This is basically the same as for domain1, just the domain name is different. The code of domain2 is in /home/user/public_html/domain2.com/current/
httpd.conf is empty (I think this is ok for Apache 2.2), the relevant part of apache2.conf is:
ServerRoot "/etc/apache2"
# Include generic snippets of statements
Include /etc/apache2/conf.d/
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
ServerName 23.42.74.241
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.9
PassengerRuby /usr/local/bin/ruby
PassengerDefaultUser user
/etc/apache2/conf.d/servername.conf is:
ServerName general
I'm not sure if this name ("general") is relevant at all...
After a sudo /etc/init.d/apache2 restart domain1.com still workes perfectly, domain2 not. DNS settings are the same for domain1 and domain2, a test gives me the right DNS server for domain2. The only error using www.dns-info.cz is:
attendance of NS records in the zone (info) ERROR
The zone does not contain any NS record although at least one name server returns authoritative data for this domain name. The zone must contain the same NS records as parent server.
I'm not sure if this error is directly connected to the problem, this is just for your information. Does anybody know how to resolve this issue?