Redirect http-https

how can i Manage to work my seafile server. i have site with apache redirect from http://mysite.com to https://mysite.com, seafile works on http://mysite:8000. But browser always redirect to https://mysite.com:8000 and seafile doesnt work from web. if i chenge configuration of seafile to use https mysite stop work because of seafile.

have you edited the settings on the image in the admin panel

if i use https for seafile it doesnt work at all, because mysite has the same name

post your apache config,

Summary

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request’s Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
#Redirect / https://kabinet56.ru/
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
#<Directory /var/www/html>
#Options -Indexes +FollowSymLinks +MultiViews
#AllowOverride All
#Require all granted
#
# Available loglevels: trace8, …, trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf

RewriteRule /SOGo(.*) https://%{HTTP_HOST}%{REQUEST_URI}
#Alias /baikal “/var/www/baikal/html”
#<FilesMatch .php$>

2.4.10+ can proxy to unix socket

#SetHandler “proxy:unix:/var/run/php/php7.0-fpm.sock|fcgi://localhost/”

<FilesMatch “.php$”>

#        SetHandler "proxy:fcgi://0.0.0.0:9000/"

#ProxyPassMatch ^/(..php(/.)?)$ fcgi://127.0.0.1:9000/srv/http/kabinet56.ru/$1
#SetHandler “proxy:unix:/var/run/php/php7.0-fpm.sock|fcgi://localhost/”

#

DirectoryIndex index.php index.htm index.html index.xht index.xhtml

#
Alias /media /home/ubuntu/seafile-server-latest/seahub/media
#Alias /seafmedia /home/ubuntu/seafile-server-latest/seahub/media
RewriteEngine On
<Location /media>

<Location /seafmedia>

ProxyPass !

Require all granted

#SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1
#SetEnvIf Request_URI . proxy-fcgi-pathinfo=1

RewriteEngine On

seafile fileserver

ProxyPass /seafhttp http://127.0.0.1:8082
ProxyPassReverse /seafhttp http://127.0.0.1:8082
RewriteRule ^/seafhttp - [QSA,L]

ProxyPass /seafdav http://127.0.0.1:8008/seafdav
ProxyPassReverse /seafdav http://127.0.0.1:8008/seafdav

seahub

SetEnvIf Request_URI . proxy-fcgi-pathinfo=1

SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
#ProxyPass /seafile fcgi://127.0.0.1:8000/seafile/

have you installed “certbot” to use the https mode, I do not see the SSL configuration in your config.
use the manual config to install certificates to use https
https://manual.seafile.com/deploy/https_with_apache.html

Summary ServerAdmin webmaster@localhost #Protocols h2 http/1.1
	DocumentRoot /var/www/html

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf

	#   SSL Engine Switch:
	#   Enable/Disable SSL for this virtual host.
	SSLEngine on

SSLCipherSuite
SSLHonorCipherOrder on

	#   A self-signed (snakeoil) certificate can be created by installing
	#   the ssl-cert package. See
	#   /usr/share/doc/apache2/README.Debian.gz for more info.
	#   If both key and certificate are stored in the same file, only the
	#   SSLCertificateFile directive is needed.
	SSLCertificateFile /etc/ssl/kabinet.key/kabinet56.ru.crt
	SSLCertificateKeyFile /etc/ssl/kabinet.key/kabinet56.ru.key

	#   Server Certificate Chain:
	#   Point SSLCertificateChainFile at a file containing the
	#   concatenation of PEM encoded CA certificates which form the
	#   certificate chain for the server certificate. Alternatively
	#   the referenced file can be the same as SSLCertificateFile
	#   when the CA certificates are directly appended to the server
	#   certificate for convinience.
	#SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt

	#   Certificate Authority (CA):
	#   Set the CA certificate verification path where to find CA
	#   certificates for client authentication or alternatively one
	#   huge file containing all of them (file must be PEM encoded)
	#   Note: Inside SSLCACertificatePath you need hash symlinks
	#		 to point to the certificate files. Use the provided
	#		 Makefile to update the hash symlinks after changes.
	#SSLCACertificatePath /etc/ssl/certs/
	SSLCACertificateFile /etc/ssl/kabinet.key/kabinet56.ru.ca-bundle

	
	<FilesMatch "\.(cgi|shtml|phtml|php)$">
			SSLOptions +StdEnvVars
	</FilesMatch>
	<Directory /usr/lib/cgi-bin>
			SSLOptions +StdEnvVars
	</Directory>


	BrowserMatch "MSIE [2-6]" \
			nokeepalive ssl-unclean-shutdown \
			downgrade-1.0 force-response-1.0
	# MSIE 7 and newer should be able to use keepalive
	BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

Alias /iredadmin/static “/opt/www/iredadmin/static/”
WSGIScriptAlias /iredadmin “/opt/www/iredadmin/iredadmin.py/”
Alias /mail “/opt/www/roundcubemail/”
ProxyPass /Microsoft-Server-ActiveSync http://127.0.0.1:20000/SOGo/Microsoft-Server-ActiveSync retry=60 connectiontimeout=5 timeout=3540
ProxyPass /SOGo http://127.0.0.1:20000/SOGo retry=0

Alias /awstats/icon “/usr/share/awstats/icon/”
Alias /awstatsicon “/usr/share/awstats/icon/”
Alias /cal/ “/usr/share/davical/htdocs”
ScriptAlias /awstats “/usr/lib/cgi-bin/”
Alias /cloud “/var/www/nextcloud”
Redirect 301 /.well-known/carddav /cloud/remote.php/dav
Redirect 301 /.well-known/caldav /cloud/remote.php/dav



Header set Strict-Transport-Security “max-age=15552000; includeSubDomains; preload” env=HTTPS
Header always set Referrer-Policy “strict-origin”

i dont Use ssl with seafile because i cant, i write earlier why

Не удалось получить http://ppa.launchpad.net/certbot/certbot/ubuntu/dists/jessie/main/binary-amd64/Packages 404 Not Found

which version of Ubuntu you are using?

I use debian jessie

Please follow the community manual and use nginx. It will guide to through ever step.

Nginx is very hard to config, i dont have enough knolege(((

It is a guide! Read it and you will be served.

Where is it?

Thank you very much, now all work good, only one thing i cant open files from android app, i see files but cant download and say that file has been deleted. I fogot change url in web, now all is ok, many thanks

1 Like

nginx is simpler then apache and lighter. All in one config file, no addons… /ot

2 Likes

may be, but now i cant even test php work or not, my php site wich work on apache doesnt work here, all wha i see it is greating page of nginx or 404 error)))))

Please read about nginx here.
http://nginx.org/en/docs/beginners_guide.html

Super simple with php-fpm.