How do I configure SSL on Apache on Ubuntu? - apache

I tried to enable SSL on my Apache server on Ubuntu, but when I restart the Apache server it shows the following error:
Syntax error on line 3 of /etc/apache2/sites-enabled/000-default:
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.

That is complaining about mod_rewrite not your ssl cert.
Try
sudo a2enmod rewrite
sudo service apache2 restart

Related

Apache/2.4.18 (Ubuntu) mod_proxy_wstunnel

I'm trying to use the Websocket Proxy in Apache, but keeps reporting non existent module.
$ sudo a2enmod mod_proxy_wstunnel
ERROR: Module mod_proxy_wstunnel does not exist!
This should be available from 2.4.5!
https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html
Is this an Ubuntu version problem?
How can I install this?
Try with proxy_wstunnel
$ sudo a2enmod proxy_wstunnel

Invalid Command 'RewriteEngine' but mod_rewrite is enabled

I am setting up a gitlab site with this conf file
But this error arise:
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
I have install apache 2.4.20 from source. And forgot that I have installed 2.4.7 with apt-get. Right now apache -v shows 2.4.7 though.
I have followed a lot of solutions but they do not work:
Inside the httpd.conf file uncomment the line LoadModule rewrite_module modules/mod_rewrite.so (remove the pound '#' sign from in front of the line)
Apache2 ProxyPass for Rails App Gitlab
I have check the rewrite modules and it is there; a2enmod rewrite is enabled and service apache2 restart worked without the gitlab.conf file.
But with gitlab.conf, this error appear Invalid command 'RewriteEngine'?
I am having the same issue using Vagrant to setup a VM.
I finally resolved this by setting the ip for the client in the Vagrantfile configs:
config.vm.network :private_network, ip: "192.168.68.8"
Then adding to the local /etc/hosts file:
192.168.68.8 namespace.dev

httpd server service location?

Following is not working.
/etc/init.d https restart
serive httpd restart
I don't see any file related to httpd in /etc/init.d
Although httpd server is running fine. httpd.conf file is also not present in /etc.
where should i look?
Please help in restarting the service.
Can you specify which distro you are using?
Ubuntu 12.04LTS: service apache2 restart
Debian 6: service apache2 restart
Redhat: /sbin/service httpd restart
Centos 7:
/etc/systemd/system/multi-user.target.wants/httpd.service
Which points to:
/usr/lib/systemd/system/httpd.service

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"

Apache2 SSL certificate file issue

I am new to https ( HTTP using SSL). I have managed to generate a self signed certificate file and have added the following lines to the apache conf file:
SSLEngine on
SSLCertificateFile /path/to/cert/file/myfile.crt
SSLCertificateKeyFile /path/to/key/file/myfile.key
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
The issue I am having is that when I try to restart my server I get the following error and am confused why it is not able to read it:
Starting web server apache2
Syntax error on line 1 of /path/to/cert/file/myfile.crt:
Invalid command 'MIIDtTCCAx6gAwIBAgIJAOnu0fcwBt1BMA0GCSqGSIb3DQEBBQUAMIGZMQswCQYD', perhaps misspelled or defined by a module not included in the server configuration
...fail!
Any ideas?
Maybe it tries to interpret the certificate file as a script. Is the crt file executable?
man this is outdated.. well i guess you should start from the beginning with a good howto. just google apache2 ssl howto.
propably apache has no ssl module loaded.
on debian you could try apache2ctl -M to list all loaded modules.