By alsaro
server { listen 80; listen [::]:80 default_server ipv6only=on; return 301 http://$host$request_uri; }
server { # Enable HTTP/2 listen 443 ssl http2; listen [::]:443 ssl http2; server_name test.example.com;
# Use the Let’s Encrypt certificates
ssl_certificate /etc/letsencrypt/live/test.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/test.example.com/privkey.pem;
# Include the SSL configuration from cipherli.st
include snippets/ssl-params.conf;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:5000/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
}
server { # Enable HTTP/2 listen 443 ssl http2; listen [::]:443 ssl http2; server_name test2.example.com;
# Use the Let’s Encrypt certificates
ssl_certificate /etc/letsencrypt/live/test.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/test.example.com/privkey.pem;
# Include the SSL configuration from cipherli.st
include snippets/ssl-params.conf;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:5000/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
}
/opt/letsencrypt/certbot-auto --cert-name test.example.com -d test.example.com -d test1.example.com**
the error
nginx: [error] invalid PID number “” in “/run/nginx.pid” Encountered exception during recovery nginx restart failed:
Traceback (most recent call last): File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/error_handler.py”, line 103, in _call_registered self.funcs-1 File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/auth_handler.py”, line 308, in _cleanup_challenges self.auth.cleanup(achalls) File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot_nginx/configurator.py”, line 1055, in cleanup self.restart() File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot_nginx/configurator.py”, line 846, in restart nginx_restart(self.conf(‘ctl’), self.nginx_conf) File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot_nginx/configurator.py”, line 1106, in nginx_restart “nginx restart failed:\n%s\n%s” % (out.read(), err.read())) MisconfigurationError: nginx restart failed:
An unexpected error occurred: UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe2 in position 7: ordinal not in range(128)
both domain works but one with ssl and another without ssl and i am always getting error when trying to restart nginx
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
From the errors you are seeing it looks like Nginx was not running on your system when you attempted to run LetsEncrypt. This is why the “invalid pid number” error shows up. Try running service nginx start before attempting to generate your certificate.
This comment has been deleted
i fixed the problem by remove all comments :) from nginx configuration
i removed this one # Use the Let’s Encrypt certificates
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.