• Benvenuti su RaspberryItaly!
Benvenuto ospite! Login Login con Facebook Registrati Login with Facebook


Valutazione discussione:
  • 0 voto(i) - 0 media
  • 1
  • 2
  • 3
  • 4
  • 5

[-]
Tags
a da https reindirizzamento http

Reindirizzamento da http a https
#1
Buon giorno, ho cercato un po' sul forum e su Google, ma non ho trovato nulla di interessante. 
Ho configurato un sistema con nextcloud con mariadb, apache, php, pihole, un hdd in condivisione con samba, motioneye e webmin il tutto accessibile tramite VPN e solo nextcloud tramite ddns. 
La guida che ho seguito per configurare nextcloud mi portava a bloccare l'http e indirizzare il tutto verso l'https,solo che non funziona il reindirizzamento automatico. 
Tra l'altro ho notato un errore http nel server apache,credo che i due problemi siano collegati. 
Sapreste indicarmi dove sta il problema? 
Grazie a chi mi saprà rispondere
Risposta
#2
Punto primo che errore hai trovato nel server Apache?

Punto secondo consiglio sempre di dividere il Raspberry con funzionalità server web da altri servizi tipo PiVpn e vari

Punto 3 il certificato Lets Encrypts per https l'hai abilitato?

Punto 4 per il redirect da http ad https hai 2 possibilità o inserisci questa voce nel file configurazione Apache tuo porta 80
Inserire nel file nel tag virtualhost

<Virtualhost>
RewriteEngine on
RewriteCond %{SERVER_NAME} =TUO DDNS
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>

Dove per Tuoddns immetti il tuo

Oppure crei un file .htaccess nella home inserendo tale voce senza tag virtualhost.

Ti rammento che se hai generato tu il certificato per https avrai nei browser errore di certificato non valido perché non rilasciato da un ente accreditato, sebbene accettando allert tutto funzionerà.

Ti consiglio di generare certificati con Lets encrypts. Trovi guida mia in questo forum

See You
Risposta
#3
Questo è ciò che esce da apache:
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset:
Active: failed (Result: exit-code) since Mon 2019-01-28 09:09:18 CET; 16min a
Process: 563 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILUR

gen 28 09:09:18 raspberrypi apachectl[563]: (98)Address already in use: AH00072:
gen 28 09:09:18 raspberrypi apachectl[563]: (98)Address already in use: AH00072:
gen 28 09:09:18 raspberrypi apachectl[563]: no listening sockets available, shut
gen 28 09:09:18 raspberrypi apachectl[563]: AH00015: Unable to open logs
gen 28 09:09:18 raspberrypi apachectl[563]: Action 'start' failed.
gen 28 09:09:18 raspberrypi apachectl[563]: The Apache error log may have more i
gen 28 09:09:18 raspberrypi systemd[1]: apache2.service: Control process exited,
gen 28 09:09:18 raspberrypi systemd[1]: Failed to start The Apache HTTP Server.
gen 28 09:09:18 raspberrypi systemd[1]: apache2.service: Unit entered failed sta
gen 28 09:09:18 raspberrypi systemd[1]: apache2.service: Failed with result 'exi
-il redirect http-https lho inserito come da suo esempio ma non va.
-il certificato lho generato senza letsencrypts ma se non da problemi a me non importa se da avviso nel browser


Inviato dal mio BKL-L09 utilizzando Tapatalk
Risposta
#4
Posta il tuo file di configurazione Apache sulla porta 80 che ci diamo uno sguardo hai commesso qualche errore
Risposta
#5
(28/01/2019, 09:37)Tiger Ha scritto: Posta il tuo file di configurazione Apache sulla porta 80 che ci diamo uno sguardo hai commesso qualche errore
Spero di aver fatto bene, non sono tanto pratico con i forum e tra l'altro sono con il tel.

GNU nano 2.7.4 File: /etc/apache2/apache2.conf
# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>




# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
GNU nano 2.7.4 File: /etc/apache2/apache2.conf
# not allow access to the root filesystem outside of /usr/share and /var/www.# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
GNU nano 2.7.4 File: /etc/apache2/apache2.conf # not allow access to the root filesystem outside of /usr/share and /var/www.# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

GNU nano 2.7.4 File: /etc/apache2/apache2.conf
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
GNU nano 2.7.4 File: /etc/apache2/apache2.conf
# for additional configuration directives. See also the AllowOverride
# directive.
#
GNU nano 2.7.4 File: /etc/apache2/apache2.conf
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients. #
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive. #
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests. #
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
# LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vho$LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent
# Include of directories ignores editors' and dpkg's backup files, # see README.Debian for details. # Include generic snippets of statements IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations: IncludeOptional sites-enabled/*.conf


Inviato dal mio BKL-L09 utilizzando Tapatalk
Risposta
#6
posta il contenuto del file di configurazione del tuo sito, non apache.conf

ma quello nella cartella /etc/apache2/sites-available/
Risposta
#7
(28/01/2019, 10:53)Tiger Ha scritto: posta il contenuto del file di configurazione del tuo sito, non apache.conf

ma quello nella cartella /etc/apache2/sites-available/
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost

Dici questo?
Poi avevo modificato con quello scritto nel tuo post iniziale

Inviato dal mio BKL-L09 utilizzando Tapatalk
Risposta
#8
(28/01/2019, 10:59)Murdock84 Ha scritto:
(28/01/2019, 10:53)Tiger Ha scritto: posta il contenuto del file di configurazione del tuo sito, non apache.conf

ma quello nella cartella /etc/apache2/sites-available/
<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   DocumentRoot /var/www/html
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost

Dici questo?
Poi avevo modificato con quello scritto nel tuo post iniziale

Inviato dal mio BKL-L09 utilizzando Tapatalk


il tuo ddns  me lo trascivi?
Risposta
#9
(28/01/2019, 11:25)Tiger Ha scritto:
(28/01/2019, 10:59)Murdock84 Ha scritto:
(28/01/2019, 10:53)Tiger Ha scritto: posta il contenuto del file di configurazione del tuo sito, non apache.conf

ma quello nella cartella /etc/apache2/sites-available/
<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   DocumentRoot /var/www/html
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost

Dici questo?
Poi avevo modificato con quello scritto nel tuo post iniziale

Inviato dal mio BKL-L09 utilizzando Tapatalk


il tuo ddns  me lo trascivi?
Murdock984.dlinkddns.com

Inviato dal mio BKL-L09 utilizzando Tapatalk
Risposta
#10
modifica il file con queste direttive qui


Codice:
<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
       
       ServerName  murdock984.dlinkddns.com
       ServerAlias murdock984.dlinkddns.com
ServerAdmin webmaster@localhost
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
RewriteEngine on
RewriteCond %{SERVER_NAME} =Murdock984.dlinkddns.com

RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Dovresti avere anche un altro file di configurazione per la https porta 443
Risposta
  


Vai al forum:


Navigazione: 1 Ospite(i)
Forum con nuovi Post
Forum senza nuovi post
Forum bloccato
Forum Redirect