Domain name: http://www.xxx.com, ports. The conf has added 888, 88 and Listen Listen nextcloudssl. Conf modified good, link https://www.xxx.com:888 can be used normally, but the link http://www.xxx.com:88 redirect to https://www.xxx.com, how to modify the nextcloud. Conf to redirect to https://www.xxx.com:888,
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Nextcloud. The conf code is as follows:
DocumentRoot/var/WWW/nextcloud/
ServerName xxx.com
ServerAlias www.xxx.com
AllowOverride All
The Require all granted
ErrorLog ${APACHE_LOG_DIR}/error log
CustomLog ${APACHE_LOG_DIR}/access log combined
RewriteEngine on
The RewriteCond % {SERVER_NAME} [OR]
=xxx.comThe RewriteCond % {SERVER_NAME}
=www.xxx.comRewriteCond % {SERVER_PORT}! ^ $888
RewriteRule ^ https://% {SERVER_NAME} : 888% {REQUEST_URI} [END, NE, R=permanent]
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Nextcloudssl. The conf code is as follows:
ServerAdmin [email protected]
ServerName www.xxx.com
DocumentRoot/var/WWW/nextcloud
AllowOverride All
Dav off
The SetEnv HOME/var/WWW/nextcloud
The SetEnv HTTP_HOME/var/WWW/nextcloud
The Header always set Strict - Transport ws-security "Max - age=15768000; Preload
"
SSLEngine on
SSLCertificateFile/etc/apache2/cert/XXX. Public. CRT
SSLCertificateKeyFile/etc/apache2/cert/XXX. Key
SSLCertificateChainFile/etc/apache2/cert/XXX. Chain. CRT
CodePudding user response:
Top up ah,,,,,,,CodePudding user response:
Under the web root directory to create a new.htaccess file, put the following code in the go to theRewriteEngine On
The RewriteCond % {HTTPS} off
RewriteRule (. *) https://% {REQUEST_URI} {HTTP_HOST} % (R, L)
The above code for HTTP route to jump to HTTPS, the premise is you can HTTP and HTTPS set no problem,