[Risolto] apache2 problemi nel configurare più siti

Installazione, configurazione e uso di Ubuntu come server: web, ftp, mail, news, proxy, dns e altro.
Scrivi risposta
Kimitsu
Prode Principiante
Messaggi: 63
Iscrizione: giovedì 25 agosto 2011, 11:27

[Risolto] apache2 problemi nel configurare più siti

Messaggio da Kimitsu »

Salve a tutti,
come da titolo ho qualche problema ad accedere a un server locale dalla rete esterna... è la prima volta che ci provo quindi siate pazienti :muro:

premessa: è da un po'che uso la piattaforma lamp per sperimentare con php e mysql, finora nessun problema a usare apache2 in locale ( tranne un piccolo intoppo coi permessi risolto sempre grazie a un santo utente di questo forum ) poi, in un impeto di masochismo, ho riesumato un vecchio netbook acer aspire one ( si, mi rendo conto che non è la macchina più idonea a fare da server... ma per fare un primo esperimento avevo solo quello ) ho installato ubuntu server 17.04 e a seguire la stessa piattaforma lamp.

A questo punto settato la connessione in modo che usasse un ip fisso 192.168.1.99, quindi sono entrato nelle impostazioni del modem e ho aperto la porta 80 per apache2 e la porta 22 per ssh, infine ho aperto le stesse porte su ufw.

Quindi ho modificato il file di configurazione di apache per impostare la directory /home/utente come directory principale, ho modificato i permessi, copiato e modificato il file di configurazione dei siti disponibili.

Ho inserito una pagina di prova in quello che dovrebbe essere il primo sito... e non si vede neanche per sbaglio mi dice sempre che non ho i permessi per accedere :muro:

Immagino di aver saltato qualche passaggio fondamentale, ma non riesco a trovare la risposta nè nelle varie guide online nè nel forum...

Qualche domanda a parte...

1) ho notato che, quando il netbook acquisiva automaticamente l'indirizzo ip, il modem nè acquisiva anche l'hostname ( veniva elencato fra i dispositivi connessi ); dal momento in cui ho impostato l'indirizzo ip statico il modem non lo acquisisce più ( l'ho dovuto individuare tramite indirizzo MAC )...avrò sbagliato qualcosa nel configurare l'ip statico ?

2) per accedere a un sito in locale (dallo stesso pc su cui gira apache2) l'indirizzo è localhost/file.html...
che indirizzo dovrei usare per accedere al sito da un altro pc connesso allo stesso modem ?
allo stesso modo che indirizzo devo usare per accedere dall'esterno ( per esempio da cellulare) ?
Ho fatto diverse prove con l'indirizzo ip pubblico del modem e la porta 80 ma non c'è verso ( immagino sia una domanda talmente stupida che è per questo che non trovo risposta in giro... di nuovo, abbiate pazienza :muro: )

3) il modem ha un suo firewall basilare ma pare non sia configurabile in modo da aprire qualche porta, potrebbe essere in questo parte del problema o si basa sulle impostazioni delle porte ?

Grazie in anticipo per l'aiuto ( e la pazienza )
Ultima modifica di Kimitsu il giovedì 21 settembre 2017, 1:01, modificato 2 volte in totale.
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: apache2 problemi per accedere da internet

Messaggio da thece »

:ciao:

iniziamo dalla parte facile
Kimitsu [url=https://forum.ubuntu-it.org/viewtopic.php?p=5008885#p5008885][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: 1) ho notato che, quando il netbook acquisiva automaticamente l'indirizzo ip, il modem nè acquisiva anche l'hostname ( veniva elencato fra i dispositivi connessi ); dal momento in cui ho impostato l'indirizzo ip statico il modem non lo acquisisce più ( l'ho dovuto individuare tramite indirizzo MAC )...avrò sbagliato qualcosa nel configurare l'ip statico ?
come hai svolto questo punto?
Kimitsu
Prode Principiante
Messaggi: 63
Iscrizione: giovedì 25 agosto 2011, 11:27

Re: apache2 problemi per accedere da internet

Messaggio da Kimitsu »

Ho usato questa guida

gnulinuxarea.wordpress.com/2010/10/22/ubuntu-come-impostare-un-ip-statico-via-terminale-su-connessione-ethernet/

L'attuale contenuto del file è questo:

Codice: Seleziona tutto

  GNU nano 2.7.4                                                           File: /etc/network/interfaces                                                                       

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp1s0
iface enp1s0 inet static
address 192.168.1.99
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameserver 208.67.222.222

Grazie per l'aiuto ^_^
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: apache2 problemi per accedere da internet

Messaggio da thece »

Dunque:

- una correzione: come primo server DNS è sempre bene impostare il proprio modem / router ADSL in modo da sfruttare il server DNS locale al device stesso in modo da risolvere correttamente i nomi degli host della propria LAN. Inoltre bisognerebbe specificare sempre almeno due server DNS in modo tale che se il primo non risponde ci si possa rivolgere al secondo.

- un suggerimento: le direttive network e broadcast non è necessario compilarle. Vengolo calcolate automaticamente dall'indirizzo IP e dalla netmask.

Quindi il tuo file io lo correggerei in

Codice: Seleziona tutto

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp1s0
iface enp1s0 inet static
address 192.168.1.99
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameserver 192.168.1.1 208.67.222.222 208.67.220.220
Andiamo avanti ... domanda: nelle tue intenzioni a cosa dovrebbe servire il firewall installato su quell'host? Da chi o che cosa dovrebbe proteggerti? Come è configurato?
Kimitsu
Prode Principiante
Messaggi: 63
Iscrizione: giovedì 25 agosto 2011, 11:27

Re: apache2 problemi per accedere da internet

Messaggio da Kimitsu »

Modifiche effettuate come suggerito.

Il firewall in realtà non è stato messo lì con uno scopo ben preciso... è vero che uno dei siti che vorrei implementare serve a gestire i tesseramenti di una piccola associazione sportiva e sono dati personali, ma è anche vero che non mi viene in mente uno straccio di motivo per cui qualcuno dovrebbe provare a violarlo...
Posto questo, più per abitudine che per altro ho abilitato ufw appena finito di installare ubuntu server, di seguito le impostazioni...

Codice: Seleziona tutto

utente@host:~$ sudo ufw status
Stato: attivo

A                          Azione      Da
-                          ------      --
22/tcp                     ALLOW       Anywhere                  
80/tcp                     ALLOW       Anywhere                  
22/tcp (v6)                ALLOW       Anywhere (v6)             
80/tcp (v6)                ALLOW       Anywhere (v6)  
Nel modem c'è un altro firewall, molto basilare, per ora non ho trovato opzioni che mi permettano di aprire le porte e non sono certo che funzioni in concomitanza col port range forwording ( nel senso che spero che una volta configurate le porte il firewall faccia passare ma non ne ho la certezza ).
Ho provato a disabilitarlo, ma non è cambiato niente, il che indica che o non è un problema o ( più probabile) non è l'unico problema.
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: apache2 problemi per accedere da internet

Messaggio da thece »

OK, comunque era solamente una mia curiosità. Il problema non è quel firewall.

Il problema sui permessi di accesso è dovuto al fatto che probabilmente hai modificato il file /etc/apache2/sites-enabled/000-default.conf ma non il file /etc/apache2/apache2.conf. Bastava una ricerchina in Rete
Kimitsu [url=https://forum.ubuntu-it.org/viewtopic.php?p=5008885#p5008885][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: 2) per accedere a un sito in locale (dallo stesso pc su cui gira apache2) l'indirizzo è localhost/file.html...
che indirizzo dovrei usare per accedere al sito da un altro pc connesso allo stesso modem ?
http://INDIRIZZO_IP_PRIVATO_TUO_SERVER/file.html
Kimitsu [url=https://forum.ubuntu-it.org/viewtopic.php?p=5008885#p5008885][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: allo stesso modo che indirizzo devo usare per accedere dall'esterno ( per esempio da cellulare) ?
Ho fatto diverse prove con l'indirizzo ip pubblico del modem e la porta 80 ma non c'è verso ( immagino sia una domanda talmente stupida che è per questo che non trovo risposta in giro... di nuovo, abbiate pazienza :muro: )
http://INDIRIZZO_IP_PUBBLICO_TUO_SERVER/file.html

oppure

http://FQDN_TUO_SERVER/file.html
Ultima modifica di thece il martedì 19 settembre 2017, 22:14, modificato 2 volte in totale.
Kimitsu
Prode Principiante
Messaggi: 63
Iscrizione: giovedì 25 agosto 2011, 11:27

Re: apache2 problemi per accedere da internet

Messaggio da Kimitsu »

Ho cercato in rete e infatti ho modificato entrambi i file,
solo che probabilmente ho sbagliato qualcosa... ti mando entrambi...
Kimitsu
Prode Principiante
Messaggi: 63
Iscrizione: giovedì 25 agosto 2011, 11:27

Re: apache2 problemi per accedere da internet

Messaggio da Kimitsu »

Questa è la guida che principalmente ho seguito

guida

QUesto il contenuto di apache2.conf ( solo la parte da me aggiunta/modificata )
seguendo la guida ho optato per salvare i siti nel percorso /home/utente/public/sito1-sito2-sito3 ecc...

Codice: Seleziona tutto

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

<Directory /home/kimitsu/public/sito1>
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
</Directory>

<Directory /home/kimitsu/public/sito2>
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
</Directory>

<Directory /home/kimitsu/public/sito3>
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
</Directory>

<Directory /home/kimitsu/public/sito4>
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
</Directory>

<Directory /home/kimitsu/public/sito5>
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
</Directory>
poi nel cartella /etc/apache2/sites-available ci sono vari file di configurazione sito1.conf sito2.conf ecc...

Codice: Seleziona tutto

<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

        ServerAdmin kimitsu@localhost
        DocumentRoot /home/kimitsu/public/sito1

        # 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

<Directory /home/kimitsu/public/sito1>
                AllowOverride All
                Options -Indexes +FollowSymLinks +MultiViews
                Require all granted
        </Directory>

    ErrorLog /var/log/apache2/janhu.err
    LogLevel warn
    CustomLog /var/log/apache2/janhu.log combined

    ServerSignature Off
</VirtualHost>


http://INDIRIZZO_IP_PRIVATO_TUO_SERVER/file.html
ho provato ma firefox riporta "connessione non riuscita. impossibile contattare il server"


http://INDIRIZZO_IP_PUBBLICO_TUO_SERVER/file.html
stesso risultato che con l'ip privato...
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: apache2 problemi per accedere da internet

Messaggio da thece »

Presta attenzione, sei molto "sporco" nel modificare le configurazioni

Non conosco Apache, ma dovrebbe bastare questo

/etc/apache2/apache2.conf

Codice: Seleziona tutto

...
<Directory /home/kimitsu/public/sito1>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
...
/etc/apache2/sites-enabled/000-default.conf

Codice: Seleziona tutto

<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

	ServerAdmin kimitsu@localhost
	DocumentRoot /home/kimitsu/public/sito1

	# 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
	LogLevel warn

	# ErrorLog ${APACHE_LOG_DIR}/error.log
	ErrorLog /var/log/apache2/janhu.err
		
	# CustomLog ${APACHE_LOG_DIR}/access.log combined
	CustomLog /var/log/apache2/janhu.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

	ServerSignature Off
</VirtualHost>
... almeno sul piccolo test che ho fatto io ha funzionato.
Nella guida che hai linkato tu (scorrendola molto velocemente) vengono fatte molte più cose. Questi semplici passaggi potrebbero non bastare.
Kimitsu
Prode Principiante
Messaggi: 63
Iscrizione: giovedì 25 agosto 2011, 11:27

Re: apache2 problemi per accedere da internet

Messaggio da Kimitsu »

Si sono decisamente poco pratico... :muro:

Però sia in quella che in altre guide, se non ricordo male, ogni sito implementato ha la sua cartella abilitata singolarmente in apache2.conf e il suo file esempio.conf in sites-available... O.o
forse non ho capito che intendi con "basta questo"...

La guida l'ho seguita praticamente tutta, uniche 3 differenze sono che non ho installato phpmyadmin, ho abilitato il sito2 senza disabilitare il sito1, e in apache2.conf ho messo require all granted invece di allow override all ( che da prove precedenti risultva un'istruzione obsoleta, problema risolto sempre grazie ad un altro utente gentilissimo )

Comunque con l'indirizzo ip sia pubblico che privato firefox non riesce a contattare il server, sparito l'errore 403 O.o

Possibile dipenda dalla modifica del file /etc/network/interfaces ?
il contenuto adesso è questo

Codice: Seleziona tutto

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp1s0
iface enp1s0 inet static
address 192.168.1.99
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameserver 192.168.1.1 208.67.222.222 208.67.220.220


Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: apache2 problemi per accedere da internet

Messaggio da thece »

No
Kimitsu [url=https://forum.ubuntu-it.org/viewtopic.php?p=5008980#p5008980][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: Comunque con l'indirizzo ip sia pubblico che privato firefox non riesce a contattare il server, sparito l'errore 403 O.o
Sul modem / router hai abilitato il Port Forwarding verso il tuo server Apache?
Kimitsu
Prode Principiante
Messaggi: 63
Iscrizione: giovedì 25 agosto 2011, 11:27

Re: apache2 problemi per accedere da internet

Messaggio da Kimitsu »

si è abilitato...

Codice: Seleziona tutto

Attivo 	SSH 	         TCP: 22           Uguale a quella esterna         192.168.1.99
           Attivo 	APACHE 	TCP: 80            Uguale a quella esterna         192.168.1.99
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: apache2 problemi per accedere da internet

Messaggio da thece »

Tira giù Apache.
Tira giù il firewall.
Testa il Port Forwarding lanciando sul tuo "server" questo finto Web Server

Codice: Seleziona tutto

sudo nc -v -l -p 80
(*)

Il test fallo da questo sito http://www.canyouseeme.org/.
Se il test da esito positivo. Termina netcat e tira su Apache e riprova sia il test sia a visualizzare il sito. Se funziona il problema è il firewall. Se non funziona, il problema è Apache.



(*) per terminare il comando netcat (nc) usa CTRL + C
Ultima modifica di thece il mercoledì 20 settembre 2017, 0:48, modificato 1 volta in totale.
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: apache2 problemi per accedere da internet

Messaggio da thece »

Questi sono i miei file, quelli che ho usato per il test, con le poche modifiche che ho fatto. La Document Root l'ho spostata in /home/thece/html

/etc/apache2/apache2.conf

Codice: Seleziona tutto

# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#	/etc/apache2/
#	|-- apache2.conf
#	|	`--  ports.conf
#	|-- mods-enabled
#	|	|-- *.load
#	|	`-- *.conf
#	|-- conf-enabled
#	|	`-- *.conf
# 	`-- sites-enabled
#	 	`-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
#
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections which can be
#   customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
#   directories contain particular configuration snippets which manage modules,
#   global configuration fragments, or virtual host configurations,
#   respectively.
#
#   They are activated by symlinking available configuration files from their
#   respective *-available/ counterparts. These should be managed by using our
#   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
#   their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.


# Global configuration
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
#Mutex file:${APACHE_LOCK_DIR} default

#
# The directory where shm and other runtime files will be stored.
#

DefaultRuntimeDir ${APACHE_RUN_DIR}

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

# 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 None
#	Require all granted
#</Directory>

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

<Directory /home/thece/html>
	Options 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
# (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\"" vhost_combined
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

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
/etc/apache2/sites-available/000-default.conf

Codice: Seleziona tutto

<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

	ServerAdmin webmaster@localhost
	
	# DocumentRoot /var/www/html
	DocumentRoot /home/thece/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

	ServerSignature Off

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Kimitsu
Prode Principiante
Messaggi: 63
Iscrizione: giovedì 25 agosto 2011, 11:27

Re: apache2 problemi per accedere da internet

Messaggio da Kimitsu »

Si la configurazione che hai postato è quella base, la stessa che uso sul portatile per provare i siti in locale, e funziona tranquillamente...
il problema sorge nel provare a implementare più di un sito sullo stesso server.

sto provando a seguire questa guida ma per ora vince la mia incapacità... :muro:

In compenso è venuto fuori che l'errore 403 non era un problema legato hai permessi ( ma proprio al tentativo di implementare più siti )... a quanto pare, se chiedo al server un sito che non trova, quelo non mi dice che il sito non c'è ( perchè non riesco a impostare le diverse document root ) ma mi dice semplicemente che non ho il permesso di accedere alla cartella e mi chiude la porta in faccia...
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: apache2 problemi per accedere da internet

Messaggio da thece »

Come ti ho già detto in precedenza non conosco bene Apache, quello che potrei fare è solamente leggere una qualche guida, provare ad implementare quanto da te desiderato e poi dirti "l'ho fatto così" ...
Kimitsu
Prode Principiante
Messaggi: 63
Iscrizione: giovedì 25 agosto 2011, 11:27

Re: apache2 problemi per accedere da internet

Messaggio da Kimitsu »

dovrei aver risolto... ora come ora funziona... ( c'è voluta una notevole combinazione a bestemmie per sbloccare il tutto :lol: )

Thece...grazie mille per l'aiuto e la pazienza !!! :birra:

aggiungo il tag [risolto] nel titolo e con calma domani riporto il procedimento con cui ho risolto... va che qualche altro masochista senza speranza inciampa nella stessa idea strampalata ( visto che più volte qui mi è stata data una mano vediamo se riesco a rendere un pochino il favore :p )
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: apache2 problemi per accedere da internet

Messaggio da thece »

Kimitsu [url=https://forum.ubuntu-it.org/viewtopic.php?p=5009148#p5009148][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: dovrei aver risolto... ora come ora funziona... ( c'è voluta una notevole combinazione a bestemmie per sbloccare il tutto :lol: )
Questo è il mio quotidiano
Mah ... per quello che ho fatto

:birra:
Scrivi risposta

Ritorna a “Ubuntu su server”

Chi c’è in linea

Visualizzano questa sezione: 0 utenti iscritti e 9 ospiti