creating letsencrypt certificate fails - apache

i'm on ubuntu 17.10 . looks like installed certbot successfully.
when i run
sudo certbot --apache -d mywebsite.com -d www.mywebsite.com
i get an error:
root#servername:~# sudo certbot --apache -d mywebsite.ca -d www.mywebsite.ca
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for mywebsite.ca
http-01 challenge for www.mywebsite.ca
Enabled Apache rewrite module
Error while running apache2ctl graceful.
httpd not running, trying to start
Action 'graceful' failed.
The Apache error log may have more information.
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Any idea?
obviously apache is not running, but that's ok, i'm using nginx, so i don't need apache. or do i?

If you are running nginx server, use the nginx plugin (not apache):
sudo certbot --nginx -d mywebsite.com -d www.mywebsite.com

Related

AH00558: httpd: Could not reliably determine the server's fully qualified domain name,Set the 'ServerName' directive globally to suppress this message

I've tried to run apache server with
sudo apachectl start
sudo apachectl stop
and I encountered these errors
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using exampleui-MacBookPro.local. Set the 'ServerName' directive globally to suppress this message
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:8080
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:8080
no listening sockets available, shutting down
AH00015: Unable to open logs
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Hoonui-MacBookPro.local. Set the 'ServerName' directive globally to suppress this message
httpd (pid 6276?) not running
So I searched stackoverflow and exchanged ServerName localhost in etc/apache2/httpd.conf file to ServerName localhost:8080 and it was uncommented already.
It didn't change even after changing ServerName into
localhost
localhost:80
localhost:8080
127.0.0.1
and I also tried to kill process with kill -9 pid but nothing changed

How to run websockets on Apache via wss?

I am trying to run a PHP chat on sockets.
Server configuration: Ubuntu-18.04-amd64, Apache/2.4.29, SSL certificate from Let's Encrypt.
I use rachet. Here, here and here it is described how to connect sockets through SSL connections. But I didn’t succeed.
I installed the necessary modules in Apache:
sudo a2enmod proxy
sudo a2enmod proxy_wstunnel
sudo a2enmod proxy_http
Wrote in /etc/apache2/apache2.conf
<VirtualHost *: 443>
<Location "/chat/">
ProxyPreserveHost On
ProxyPass /ws ws://xxxxxx.xx:999
ProxyPassReverse /ws ws://xxxxxx.xx:999
</Location>
</VirtualHost>
Opened 999 port
sudo iptables -I INPUT -p tcp --dport 999 -j ACCEPT
Restarted Apache
sudo systemctl restart apache2
Launched a chat server
php /var/www/html/chat/bin/chat-server.php
Wrote in the socket call script
websocket = new WebSocket ('wss://xxxxxx.xx/chat');
I tried to connect from a browser at
https://xxxxxx.xx/chat/
And got an error
WebSocket connection to 'wss://xxxxxx.xx/chat' failed: Error during
WebSocket handshake: Unexpected response code: 301
I read various tips, but still could not understand what I was doing wrong. Any attempt to change the situation creates errors 301, 300, 500 or 200.
Please tell me what I was wrong?

using certbot-auto for nginx

I have an nginx running.
Now I want my nginx to use SSL:
certbot-auto --nginx -d my.domain.com -n --agree-tos --email admin#mail.com
OUTPUT:
Performing the following challenges:
tls-sni-01 challenge for my.domain.com
Cleaning up challenges
Cannot find a VirtualHost matching domain my.domain.com.
my.domain.com is pointing to the IP of my server. It's its dns name.
What am I doing wrong? I did this already for apache and it was working fine. My nginx is running (and I'm not able to restart it manually after the certbot-auto but this wasn't necessary when I used certbot-auto --apache
In my case, I had to add the "server_name" line because it wasn't in my nginx config so it was giving me the error message "Cannot find a VirtualHost matching domain my.domain.com" when I ran:
certbot --nginx
Make sure this is in your config:
server {
server_name my.domain.com;
....
}
Your are probably missing some Server Blocks (virtual hosts) files in the sites-enabled folder. Check if your config files exist in /etc/nginx/sites-available and /etc/nginx/sites-enabled. If they are not present in the sites-enabled folder, create symbolic links for them:
$ sudo ln -s /etc/nginx/sites-available/my.domain.com /etc/nginx/sites-enabled/
Add your site, check for config errors and restart nginx:
$ sudo certbot --nginx -d my.domain.com
$ sudo nginx -t
$ sudo service nginx restart

httpd error after install for Openldap

I have made all the settings for openldap, less then httpd.
After I installed httpd, when I tried to start it with "serice httpd start",
display the following error:
[root#elara pub]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[FAILED]
I understood from net, that i need to kill a process, but I'm very confused, because I'm nubbie in Linux.
Can' someone tell me a solution for my problem?
Sounds like you installed OpenLDAP incorrectly to listen at port 80. The correct port for LDAP is 389; 636 for LDAPS.

Apache restart on Ubuntu - error "could not bind to address 0.0.0.0.80"

I'm a n00b - trying to get apache2 set up on Ubuntu 9.10 (Karmic Koala) on Rackspace Cloud. I have set up/configured OpenSSL and installed Apache, but Apache won't start. I assume its a misconfiguration in my /etc/apache2/sites-available/ssl or /etc/apache2/sites-available/default files)
When I try to restart apache using the command:
sudo /etc/init.d/apache2 restart
I get the following error message:
[error] (EAI 2)Name or service not known: Could not resolve host name *.80 -- ignoring!
[error] (EAI 2)Name or service not known: Could not resolve host name *.80 -- ignoring!
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
...fail!
For my /etc/apache2/sites-available/ssl I have used a virtual host of *:443.
For my /etc/apache2/sites-available/default i have used a virtual host of *:80
Turn off Skype. It's use port number 80 for incoming messages. Eventually check what use this port at the moment using netstat.
Second resolve is simply: Add ServerName localhost to main config. file.
Check /etc/hosts. Be sure that your machine name and localhost domain definition is correct (ie: "127.0.0.1 localhost.localdomain localhost"
However it is highly unlikely, check /etc/apache2/ports.conf if it contains explicitly "0.0.0.0"