We are using a combination of Apache Server and NodeJs (Express) for a website. Without SSL, the Apache used to listen to port 80 and Nodejs to port 8080.
Now, I am installing SSL on the website. The Apache is set to listen to port 443. I tried to make the Nodejs listen to port 8443, 3333 etc. - setting the AWS Security Group as "Custom TCP" for the port. The problem is I am not getting any response from the Nodejs server.My hunch is that the problem is with the EC2 security group setting but cannot really put a finger on the exact issue.
The server is created for Nodejs as following :
var https = require('https');
var fs = require('fs');
...
...
var https_options = {
ca: fs.readFileSync ("/path/to/cabundle.ca-bundle", "utf8"),
key: fs.readFileSync("/path/to/sslkey.key", "utf8"),
cert: fs.readFileSync("/path/to/certificate.crt", "utf8")
};
var app = express();
var server = https.createServer(https_options, app);
....
....
server.listen(8443 or 3333);
Starting the Server does not cause any error. Browser,from where I am calling the Nodejs server, does not show any error.
Any insight is appreciated.
After Arif pointed out that this can be solved by Apache settings, I am adding the Virtualhost seetings at
/etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.example.com
Redirect permanent / https://www.example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/mysite
Servername www.example.com
SSLEngine on
SSLCertificateKeyFile /path/to/sslkey.key
SSLCertificateFile /path/to/certificate.crt
SSLCertificateChainFile /path/to/cabundle.ca-bundle
<Directory /var/www/html/mysite>
AllowOverride All
Options FollowSymlinks
</Directory>
</Virtualhost>
The client side requests are sent to https://www.example.com:8443
httpsto make request that ishttps://www.example.com:8443. If you are requestinghttps://www.example.com:8443then there is no role of apache. - Arif Khancurl -Ik https://127.0.0.1:8443) ? Did you add any rules iniptablesbefore? - ronald8192