Home > front end >  HTTP (port 88) to redirect the HTTPS (port 888)
HTTP (port 88) to redirect the HTTPS (port 888)

Time:09-29

ubuntu18, apache2
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:
ServerAdmin [email protected]
DocumentRoot/var/WWW/nextcloud/
ServerName xxx.com
ServerAlias www.xxx.com


The Options + FollowSymlinks
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


The Options + FollowSymlinks
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 the
RewriteEngine 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,
  • Related