我需要在LAMP中为HTTPS网站configuration端口80吗?

我有一个LAMPnetworking服务器,并有https://sslhosting.cz/域。

首先我附上一个一般的Let's Encryptconfiguration文件,我改变了我的需要:

/etc/letsencrypt/options-ssl-apache.conf

# Baseline setting to Include for all Let's Encrypt SSL sites SSLEngine on # Intermediate configuration, tweak to your needs SSLProtocol all -SSLv2 -SSLv3 SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDH$ SSLHonorCipherOrder on SSLCompression off SSLOptions +StrictRequire # Add vhost name to log entries: LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common #CustomLog /var/log/apache2/access.log vhost_combined #LogLevel warn #ErrorLog /var/log/apache2/error.log # Always ensure Cookies have "Secure" set (JAH 2012/1) #Header edit Set-Cookie (?i)^(.*)(;\s*secure)??((\s*;)?(.*)) "$1; Secure$3$4" # HSTS = HTTP Strict Transport Security Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload" env=HTTPS Header always set X-Frame-Options DENY # OCSP Stapling SSLCACertificateFile /etc/apache2/certificates/letsencrypt-crosssigned-stapling.pem SSLUseStapling on 

我需要在虚拟主机中为HTTPS网站configuration端口80吗? 请注意,我希望HTTP被redirect到HTTPS。

遵循特定的网站configuration:

/etc/apache2/sites-available/sslhosting.cz-le-ssl.conf

 <VirtualHost *:80> ServerName sslhosting.cz ServerAlias www.sslhosting.cz RewriteEngine on RewriteCond %{HTTPS} !on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^www\.sslhosting\.cz RewriteRule ^(.*)$ https://sslhosting.cz/$1 [R=301,L] </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin [email protected] ServerName sslhosting.cz ServerAlias www.sslhosting.cz DocumentRoot /var/www/sslhosting.cz/public_html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLCertificateFile /etc/letsencrypt/live/sslhosting.cz/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/sslhosting.cz/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> SSLStaplingCache shmcb:/tmp/stapling_cache(128000) </IfModule> 

现在,问题是:

我需要在LAMP中为HTTPS网站configuration端口80吗?

对于题为“我需要为HTTPS网站在LAMP中configuration端口80”的答案吗? 是的,你不 。 你可以在你喜欢的任何端口上运行LAMP堆栈。 常见的select包括80,443(SSL / TLS),8080,8000等

在问题里面,你添加一个皱纹,改变答案一下。

“请注意,我希望HTTP被redirect到HTTPS。”

如果你想让你的web服务器做redirect,并且假设你使用标准的http端口80 / tcp,那么答案就变成了yes 。 您需要configuration端口80以完成redirect。

为了完整起见,我可以考虑一些其他方法来获得一个不依赖于Web服务器端口80的工作configuration。

一个是在前面使用负载平衡器来处理redirect。

二是使用iptables来redirect端口。 请注意,这不会在你的情况下处理SSL / TLS要求。