I have added a new domain to Amazon linux server running apache
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/mydomain
ErrorDocument 404 /index.html
ErrorLog /var/log/mydomain.com-error_log
CustomLog /var/log/mydomain.com-access_log common
<Directory /var/www/mydomain>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</VirtualHost>
Restarted the server
checked status
sudo systemctl restart httpd active (running) 1 min
But for whatever reason the default apache index.html is served
Directory exists for the new domain , index.html is there chmod 644 done
Error log for the new domain is empty.
Access log and error lod are empty
-rw-r--r--. 1 root root 0 Dec 21 15:26 mydomain.com-access_log
-rw-r--r--. 1 root root 0 Dec 21 09:50 mydomain.com-error_log
tail of host error_log is normal
AH00489: Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1c configured -- resuming normal operations
[Mon Dec 21 15:02:24.161922 2020] [core:notice] [pid 73594:tid 140519198484800]
AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
I feel a permissions/cert problem. Or one more thing letsencrypt crt has been installed for the new domain probably successfully
[ec2-user#ip-xx-xx-xx-xx ~]$ wget mywwwdomain.com
--2020-12-21 15:57:26-- http://mywwwdomain.com/
Resolving mywwwdomain.com (mywwwdomain.com)... 55.55.55.55
Connecting to mywwwdomain.com (mywwwdomain.com)|55.55.55.55|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://mywwwdomain.com/ [following]
--2020-12-21 15:57:26-- https://mywwwdomain.com/
Connecting to mywwwdomain.com (mywwwdomain.com)|55.55.55.55|:443... connected.
ERROR: The certificate of ‘mywwwdomain.com’ is not trusted.
ERROR: The certificate of ‘mywwwdomain.com’ hasn't got a known issuer.
The certificate's owner does not match hostname ‘mywwwdomain.com’
[ec2-user#ip-xx-xx-xx-xx ~]$
55.55.55.55 - my IP address
How to debug further and fix this?
If you added a new domain in a new file, make sure the new file is properly included in the main httpd config file.
You can get a list of the VHs apache is serving issuing the following command:
# apache2ctl -S (On Debian/Ubuntu), # apachectl -S (On CentOS/RHEL) or
# httpd -S.
Related
After adding a self-signed SSL certificate, I am unable to get my Drupal site to work on localhost.
I have attempted various proposed solutions that I have found online but none have gotten me past a 400 error at https://localhost/
I have uncommented the following in httpd.conf:
LoadModule ssl_module modules/mod_ssl.so
I have Listen set to port 80 in this same file. When I set it to the SSL channel, 443, Apache does not load.
In my httpd-ssl.conf file:
I have set the paths for my server.crt and server.key files correctly.
I have enabled SSLEngine
<VirtualHost *:443>
# General setup for the virtual host
DocumentRoot "/Applications/MAMP/Library/htdocs"
ServerName https://127.0.0.1:443
ServerAdmin you#example.com
ErrorLog "/Applications/MAMP/Library/logs/error_log"
TransferLog "/Applications/MAMP/Library/logs/access_log"
I have tried a variety of possibilities for the ServerName. The one above along with localhost:443 both lead to 400 errors.
I have Listen set to 443 here. Setting to 80 so it matches the httpd.conf file leads to the same result described above...not able to connect Apache.
Here is my error log for Apache:
Digest: generating secret for digest authentication ...
Digest: done
FastCGI: process manager initialized (pid 1845)
Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.14 mod_ssl/2.2.34 OpenSSL/1.0.2o DAV/2 mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_perl/2.0.9 Perl/v5.24.0 configured -- resuming normal operations
[error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store, referer: http://localhost/MAMP/?language=English
[error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store, referer: http://localhost/MAMP/?language=English
[notice] caught SIGTERM, shutting down
I don't know enough about Apache server configuration to figure out, when I start MAMP to be able to navigate with HTTPS to my Drupal project, which is in the HTDOCs file and make it run without the 400 error.
I solved the problem by commenting out the line "Document root" above in the virtual host section.
With a LAMP server running on Ubuntu 16.04, I get the error in the log file defined as in conf :
[Tue Dec 26 16:56:35.930629 2017] [core:error] [pid 21749] (13)Permission denied: [client 127.0.0.1:43872] AH00035: access to / denied (filesystem path '/home/christophe/public_html') because search permissions are missing on a component of the path
I set my .conf file with the following :
<VirtualHost *:80>
ServerName memory.test
ServerAlias www.memory.test
DocumentRoot /home/christophe/public_html/memory/web
<Directory /home/christophe/public_html/memory/web>
AllowOverride All
Require all granted
Allow from all
</Directory>
ErrorLog /var/log/apache2/memory_error.log
CustomLog /var/log/apache2/memory_access.log combined
</VirtualHost>
The access right are set for user christophe:christophe and www-data is part of the group christophe, the mod is 775 but even with the www-data:www-data I get the error.
The /etc/hosts file contains the line :
127.0.0.1 memory.test
I seem to not have selinux installed as this solution is given in some other questions. I would not consider myself as a newbee and I succeeded to have many test environments working this way but this linux is a fresh installation and for a while no other website is working on it...
Did you check that you have 0644 in the directory you are trying to serve?, besides, you also give permissions to www-data user to access that directory, note that the folder you are trying to serve is located in your home directory.
When moving files from my main disk (where the OS is installed), to a second disk (other storage), I am trying to redirect Apache to the new disk, but this returns error number 403. I am running Ubuntu 16.04.
I originally redirected Apache to /home/user/Documents by adding the following lines to corresponding files:
in /etc/apache2/apache2.conf
<Directory /home/jawa/Documents/>
#<Directory /media/jawa/R2D2/Webpages>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
and in /etc/apache2/sites-enabled/000-default.conf
DocumentRoot /home/jawa/Documents
#DocumentRoot /media/jawa/R2D2/Webpages
This worked fine, but since I have moved the files to a new location, I must also redirect Apache.
When trying to redirect Apache to /media/jawa/R2D2/Webpages, I toggle the above comments and restart apache using sudo service apache2 restart. Visiting localhost in the browser returns error 403 and using the command cat /var/log/apache2/error.log gives the following log:
[Wed Dec 27 17:24:48.583062 2017] [core:error] [pid 22343] (13)Permission denied: [client ::1:35704] AH00035: access to / denied (filesystem path '/media/jawa/R2D2') because search permissions are missing on a component of the path
Permissions and owners of both folders:
drwxr-xr-x 2 jawa jawa 4096 dec 27 17:12 Documents
drwxrwxrwx 1 jawa jawa 0 dec 27 16:46 Webpages
What is causing the error and how can it be fixed?
Since we know one works and the other does not, list the permissions of both the folder structures :
ls -ld /home/ /home/jawa /home/jawa/Documents
ls -ld /media/ /media/jawa/ /media/jawa/R2D2 /media/jawa/R2D2/Webpages
Once listed compare the two.
The default permissions are controlled by umask and this could result in the permissions being different.
I try to setup two domains on one server, using apache and virtual hosts. I created one conf-file for each domain, but it seems that apache is always using 000-default instead of my own conf-files.
This is my directory structure:
/var/www# ls -al
-rw-r--r-- 1 www-data www-data 236 Mär 11 16:21 .htaccess
-rw-r--r-- 1 root root 43 Mär 28 05:22 index.html
drwxr-xr-x 5 www-data www-data 4096 Mär 28 05:02 domain-1.de
drwxr-xr-x 2 www-data www-data 4096 Mär 28 05:13 domain-2.de
I think I have enabled both domains:
ls -l /etc/apache2/sites-enabled/
lrwxrwxrwx 1 root root 26 Mär 7 09:18 000-default -> ../sites-available/default
lrwxrwxrwx 1 root root 38 Mär 28 03:56 domain-1.de -> ../sites-available/domain-1.de
lrwxrwxrwx 1 root root 39 Mär 28 03:56 domain-2.de -> ../sites-available/domain-2.de
This is the content of my own conf-file:
<VirtualHost *:80>
ServerName domain-2.de
ServerAlias www.domain-2.de
DocumentRoot /var/www/domain-2.de
</VirtualHost>
I restarted apache as root (service apache2 reload).
But no matter which domain, the only page that is shown is the index.html in /var/www.
This is the content of /var/log/apache2/error.log:
[Mon Mar 28 07:15:02 2016] [notice] Graceful restart requested, doing restart
[Mon Mar 28 07:15:02 2016] [notice] Apache/2.2.22 (Debian) PHP/5.4.45-0+deb7u2 configured -- resuming normal operations
I finally found the solution.
In the other_vhosts_access.log there were multiple entries like
[28/Mar/2016:09:50:11 -0500] "GET /index.html HTTP/1.1" 304 212 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
Http return code 304 means 'Not Modified', so the page was not transferred again. After clearing the browser cache, everything works as expected.
thx!
Follow below steps
sudo nano /etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerName website.localhost
ServerAlias www.website.localhost
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot "/Users/Username/Sites/website"
# Log file locations
LogLevel warn
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
<Directory /Users/Username/Sites/website>
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
Allow the vhosts configuration from the Apache configuration file httpd.conf
sudo nano /etc/apache2/httpd.conf
Search for ‘vhosts’ and uncomment the include line
Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
This will allow usage of the httpenter code hered-vhosts.conf file, open this file to add in the vhost.
sudo nano /etc/hosts
127.0.0.1 website.localhost
sudo apachectl restart
You can replace ErrorLog and CustomeLog or check the error enter code here/private/var/log/apache2/
I have a virtual machine base box for Debian wheezy that I've been using with vagrant for the last few months without any issues, however yesterday when I brought up a new machine and updated/upgraded packages I started getting a FastCGI server connection failure error:
[Wed Jun 04 14:39:03 2014] [error] [client 10.0.2.2] (13)Permission denied: FastCGI: failed to connect to server "/vagrant/php5-fcgi": connect() failed
[Wed Jun 04 14:39:03 2014] [error] [client 10.0.2.2] FastCGI: incomplete headers (0 bytes) received from server "/vagrant/php5-fcgi"
I am able to resolve the issue temporarily by manually touching and chmodding /tmp/php5-fpm-vagrant.sock, but my question is why did it start happening all of a sudden?
Personal preferences aside, is there anything functionally wrong with my configuration?:
In my apache sites available I have a file called 000php containing:
FastCgiExternalServer /vagrant/php5-fcgi -socket /tmp/php5-fpm-vagrant.sock -pass-header Authorization
Since apache loads sites alphabetically, this always gets loaded first, then I have another file called vagrant that contains:
<VirtualHost *:80 *:8080>
DocumentRoot /vagrant/public_html/
ServerName vagrant.localhost
<Directory /vagrant/>
AllowOverride all
</Directory>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /vagrant/php5-fcgi
ErrorLog ${APACHE_LOG_DIR}/vagrant_error.log
CustomLog ${APACHE_LOG_DIR}/vagrant_access.log combined
</VirtualHost>
and a php fpm pool config called vagrant.conf that looks like this:
[vagrant]
listen = /tmp/php5-fpm-vagrant.sock
listen.allowed_clients = 127.0.0.1
user = vagrant
group = vagrant
pm = ondemand
pm.max_children = 50
any suggestions would be greatly appreciated
Figured out the answer, this was caused by https://bugs.php.net/bug.php?id=67060
The fix was to add the following lines to my vagrant.conf php fpm configuration file and restart php fpm, a reload was not enough
listen.owner = www-data
listen.group = www-data
listen.mode = 0660