- 最新
- 投票最多
- 评论最多
Hi Andy,
Thank you very much for your reply. I've made the changes that you've suggested (https://photos.app.goo.gl/NNsKicxE99qrZi4r7 & https://photos.app.goo.gl/6SjLRq7odw6yTFFj6). The IP address is however still accessible.
Could it be that there's something like an AllowOverride setting somewhere that needs to be changed?
Happy to hear if you have further thoughts.
Hello,
At a high level overview, you'll want to edit your bitnamic configuration and restart the apache server. Here are changes that should work for your situation.
Make changes in the bitnami.conf and/or bitnami-ssl.conf depending on prior changes made to the instance
sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf
sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami-ssl.conf
#find section like this
<VirtualHost_default_:443>
DocumentRoot "/opt/bitnami/apache/htdocs"
SSLEngine On
#Add the following as a sibling of DocumentRoot, SSLEngine, etc...
RewriteEngine On
RewriteCond %{HTTP_HOST} !^ririro.com$
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteRule ^(.*)$ https://ririro.com$1 [R=permanent,L]
#end of changes for <VirtualHost_default_:443>
#You may also want to have similar entries for HTTP port 80 if you allow HTTP conns at all
<VirtualHost_default_:80>
DocumentRoot "/opt/bitnami/apache/htdocs"
# again, entries are sibling of DocumentRoot
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteRule ^(.*)$ https://ririro.com$1 [R=permanent,L]
#end of changes for <VirtualHost_default_:80>
#Restart apache server to pickup your changes
sudo /opt/bitnami/ctlscript.sh restart apache
Please backup any files prior to making changes to give yourself an easy way to back out if changes cause issues.
You can't actually make your static ip address inaccessible. It is the only way to reach your server from Internet.
Sounds like you want to add a permanent redirect to https://ririro.com
when visitors arrive via http://3.125.101.181/
.
Note that the visitors who arrive via https://3.125.101.181/
will not even reach your server at all because browsers will refuse to connect to your site, because its SSL server name is ririro.com
, not 3.125.101.181
.
You'll want to use redirection functionality in your web server. If it's Apache, you'll need to read this: https://httpd.apache.org/docs/2.4/rewrite/
Between reading mod_rewrite
Apache documentation and what Andy suggested and searching examples on StackOverflow, you should find the solution.
相关内容
- AWS 官方已更新 3 年前
- AWS 官方已更新 3 年前
- AWS 官方已更新 3 年前
After making changes, did you restart Apache?