I am trying to set up a website with HTTPS on a Linode server. It's working on HTTP but not on HTTPS.
I tried to use Certbot to configure my domain for HTTPS.
root#mailer9:/etc/apache2/sites-enabled# sudo certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: mailer9.com
2: www.mailer9.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):
Attempting to parse the version 0.29.1 renewal configuration file found at /etc/letsencrypt/renewal/mailer9.com.conf with version 0.28.0 of Certbot. This might not work.
Cert not yet due for renewal
You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/mailer9.com.conf)
What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for mailer9.com
http-01 challenge for www.mailer9.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/apache2/sites-enabled/mailer9.com-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-enabled/mailer9.com-le-ssl.conf
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Your existing certificate has been successfully renewed, and the new certificate
has been installed.
The new certificate covers the following domains: https://mailer9.com and
https://www.mailer9.com
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=mailer9.com
https://www.ssllabs.com/ssltest/analyze.html?d=www.mailer9.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/mailer9.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/mailer9.com/privkey.pem
Your cert will expire on 2019-04-02. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
root#mailer9:/etc/apache2/sites-enabled#
It says that thing should be working fine but it's not working in HTTPS mode.
I see two VH files in sites-enabled directory.
root#mailer9:/etc/apache2/sites-enabled# cat mailer9.com.conf
# domain: mailer9.com
# public: /var/www/html/mailer9.com/public_html/
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin xxx#yy.com
ServerName mailer9.com
ServerAlias www.mailer9.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/mailer9.com/public_html
# Log file locations
LogLevel warn
ErrorLog /var/www/html/mailer9.com/log/error.log
CustomLog /var/www/html/mailer9.com/log/access.log combined
#RewriteEngine on
#RewriteCond %{SERVER_NAME} =mailer9.com [OR]
#RewriteCond %{SERVER_NAME} =www.mailer9.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Another one for HTTPS, auto-generated by Certbot.
root#mailer9:/etc/apache2/sites-enabled# cat mailer9.com-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin xxx#yy.com
ServerName mailer9.com
ServerAlias www.mailer9.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/mailer9.com/public_html
# Log file locations
LogLevel warn
ErrorLog /var/www/html/mailer9.com/log/error.log
CustomLog /var/www/html/mailer9.com/log/access.log combined
SSLEngine on
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/mailer9.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mailer9.com/privkey.pem
</VirtualHost>
</IfModule>
root#mailer9:/etc/apache2/sites-enabled#
However, if I visit http://mailer9.com/ then it works fine. But if I go to https://mailer9.com/ the page doesn't load. I am clueless about how to solve it, everything looks fine to me.
Apache modules command apachectl -M shows ssl_module is loaded.
It was caused because of ufw firewall. I added port 443 and it fixed it.
sudo ufw allow 443/tcp
Related
I've successfully set-up an SSL-certificate through the certbot with DNS-plugin. This works great and I have issued a certificate for example.com and *.example.com:
certbot certificates output:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
Certificate Name: example.com
Domains: example.com *.example.com
Expiry Date: 2022-02-28 11:09:56+00:00 (VALID: 89 days)
Certificate Path: /etc/letsencrypt/live/example.com/fullchain.pem
Private Key Path: /etc/letsencrypt/live/example.com/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
So far so good, all domains seem to be secured correctly:
example.com = OK
test.example.com = OK
However, the issue starts for the domain test1.test.example.com. The browser keeps complaining about the fact that the domain is not secured..! I've already re-issued the SSL-certificate. This succeeds, but still the domain is marked as insecure.
Important to note, if I modify the Apache config for the domain to not redirect http (insecure) traffic to https (secure) traffic, I can access the site. This validates my apache set-up, which in fact is only 1 config file, allowing:
ServerName example.com
ServerAlias *.example.com
EDIT: Perhaps this helps. Safari tells me that the name of the certificate example.com does not match the input? Firefox returns SSL_ERROR_BAD_CERT_DOMAIN. So, I tried to update the domain to also allow *.*.example.com, but that's not allowed by certbot as it returns: Cannot issue for '*.*.example.com': Domain name has more than one wildcard
EDIT 2: The DNS-plugin generated a json-file that contains the auth-information to validate the domains. This file contains an entry fulldomain and subdomain, but the issue is with a two level 'sub-sub' domain? Perhaps this is the issue? How can I fix this, as the certbot plugin does not allow multi wildcard domains?
I've figured it out, it's not allowed to use a wildcard character before the first dot in the domain-name (at least not with the DNS-plugin I use).
Therefore, I successfully got it working adding the domain like: -d *.test.example.com
After issuing and overwriting the old certificate with the new one, this worked perfectly as expected.
example.com = OK
test.example.com = OK
test1.test.example.com = OK
I'm trying to setup a route do a basic 301 redirect with the added benefit of supporting both HTTP and HTTPS requests. Expected results would be that requests to http://subdom.domain.org or https://subdom.domain.org would receive a 301 and be forwarded to https://othersub.domain.org/route. Actual results is that https://subdom.domain.org 301's as expected, but http://subdom.domain.org 404's. With the config, you can see I've tried doing both an elevate to HTTPS with the hopes that the rule might be caught there, but with the way the middleware is configured, I would expect it would work in either scenario.
Here's my current config:
http:
routers:
subdom.domain.org:
entryPoints:
- web
- web-secure
middlewares:
- https-redirect # I've tried with this on and off
- sudbdom-redirect
service: dummy
rule: Host(`subdom.domain.org`)
tls:
certResolver: letsEncryptResolver
middlewares:
https-redirect:
redirectScheme:
scheme: https
subdom-redirect:
redirectRegex:
regex: ".*"
replacement: "https://othersub.domain.org/route"
permanent: true
services:
dummy:
loadBalancer:
servers:
- url: localhost
I was originally having trouble matching specific regex patterns for the redirect, but in realizing I didn't really need to scope the pattern at all given that I'm applying it per route, a wildcard match seems to work quite well there. Any thoughts or suggestions are appreciated. Thanks!
You should try to make 2 different router one for web entry point where you can perform redirection and 2rd one for redirectRegex where you can redirect your application to different url.
Following TLS section from official documentation:
When a TLS section is specified, it instructs Traefik that the current router is dedicated to HTTPS requests only (and that the router should ignore HTTP (non TLS) requests).
Solutions:
1. Define separate routers (for http and https), but it noisy for multiple services.
If you need to define the same route for both HTTP and HTTPS requests, you will need to define two different routers: one with the tls section, one without.
Example from documentation
2. Disable TLS for router
traefik.http.routers.YOUR-SERVICE.tls=false
Example:
services:
mailhog:
image: mailhog/mailhog
networks:
- traefik-public
deploy:
placement:
constraints:
- node.role != manager
labels:
- "traefik.enable=true"
- "traefik.http.routers.mailhog.rule=Host(`mailhog.somehost.ru`)"
- "traefik.http.routers.mailhog.service=mailhog"
- "traefik.http.routers.mailhog.entrypoints=web,websecure"
# Should be false
- "traefik.http.routers.mailhog.tls=false"
- "traefik.http.middlewares.redirectos.redirectscheme.scheme=https"
- "traefik.http.routers.mailhog.middlewares=redirectos"
- "traefik.http.services.mailhog.loadbalancer.server.port=8025"
- "traefik.tags=traefik-public"
- "traefik.docker.network=traefik-public"
I have a domain balanced in 2 IPs:
A - domain.com - 1.1.1.1
A - domain.com - 2.2.2.2
but I want to convert the IPs on CNAMEs:
So, i've created 2 "A" entries:
A - master - 1.1.1.1
A - slave - 2.2.2.2
and I want to create 2 CNAMEs from root domain to another 2 servers in order to get working as load balancer:
CNAME - domain.com - master.domain.com
CNAME - domain.com - slave.domain.com
but Cloudflare don't permitt create 2 same CNAMEs although the domain target be different
How can I create an "domain.com" entry to get targeted to the 2 another load balance servers by using CNAMEs?
I've created 2 "A" records:
A - balanced - 1.1.1.1
A - balanced - 2.2.2.2
and then link CNAME to "A"
CNAME - www - balanced.domain.com
My Apache (Linux/CentOS) is behind a load balancer (AWS ELB). So in my Apache access_log, there are tons of useless logs, like:
- - - [13/Jan/2016:23:38:02 +0800] "GET / HTTP/1.1" 200 16 "-" "ELB-HealthChecker/1.0"
- - - [13/Jan/2016:23:42:39 +0800] "OPTIONS * HTTP/1.0" 200 - "-" "Apache (internal dummy connection)"
These two logs heavily flooded in my access_log. Actually these two are totally useless for me (since they are just internal health checkers only), but affecting/confusing to my log analyzers, like awstats. So i kinda don't want to have this kind of log entries.
Is there a way to configure Apache to WHAT NOT TO log?
I get lines like these
101.102.2.137 - - [13/Sep/2013:15:20:53 +0300] "\xda\x85^iK\x94bUt\xb2DR\x12l\x19\x11\x06\xd0\x86\x88\xf43\x0c\x14e\x17\xab\xf8SUGF{L\xb0T\x91\x12\xeb\xce\xdc\x1e\x19NS\xc6+\x82;c\r\x96\xd7#\xfb\x01n" 400 226
46.47.127.146 - - [13/Sep/2013:15:23:00 +0300] "-" 408 -
92.163.103.246 - - [13/Sep/2013:15:27:23 +0300] "-" 408 -
124.84.210.50 - - [13/Sep/2013:15:59:56 +0300] "\x9e\x89\xd6" 200 4487
in my apache log and i don't know what do they mean. I use WAMP just to test stuff i don't know how can anyone get my IP to connect.
Can you tell me what the lines mean?