[Risolto] sito su server ubuntu 12.04 funziona solo se in

Installazione, configurazione e uso di Ubuntu come server: web, ftp, mail, news, proxy, dns e altro.
Scrivi risposta
vor_paul
Prode Principiante
Messaggi: 86
Iscrizione: lunedì 10 marzo 2008, 17:32

[Risolto] sito su server ubuntu 12.04 funziona solo se in

Messaggio da vor_paul »

Salve, ho installato un server lamp di ubuntu 12.04, e va tutto bene, anche il sito di default funziona.
ma quando carico il mio sito, questo funziona solo se lo copio nel sito di default /var/www.
se lo carico in cartelle diverse, cambiando la documentroot, non funziona più.
ho seguito moltissimi post e wiki sull'argomento, anche su questo forum, senza concludere niente.
di seguito la situazione reelativa all'ultima mia versione .
grazie in anticipo a chi mi può aiutare a risolvere il problema.
danilo

Codice: Seleziona tutto

~$  cat /etc/apache2/sites-available/wwwjs
<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/wwwjs/
	ServerName wwwjs
	ServerAlias wwwjs
# Indexes + Directory Root.
DirectoryIndex index.html index.htm index.php
<Directory "/var/www/wwwjs">
allow from all
Options +Indexes
</Directory>
# CGI Directory
ScriptAlias /cgi-bin/ /home/danilo/web/js/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /var/log/apache2/test/error.log
CustomLog /var/log/apache2/test/access.log combined
</VirtualHost>

Codice: Seleziona tutto

~$ cat /etc/hosts
192.168.1.24  wwwjs
192.168.1.24  genealogia
192.168.1.24  BianciDgame

Codice: Seleziona tutto

~$ ls /etc/apache2/sites-enabled/
wwwjs

Codice: Seleziona tutto

~$ ls -l /var/www/
totale 16
drwxr-xr-x 2 www-data root 4096 ago 18 16:50 BianciDgame
drwxr-xr-x 6 www-data root 4096 ago 18 16:45 genealogia
-rw-r--r-- 1 www-data root  177 ago 15 22:16 index.html
drwxr-xr-x 2 www-data root 4096 ago 16 20:41 wwwjs

Codice: Seleziona tutto

~$ ls -l /etc/apache2/sites-available/
totale 44
-rw-r--r-- 1 root root  950 feb  7  2012 default
-rw-r--r-- 1 root root 7469 feb  7  2012 default-ssl
-rw-r--r-- 1 root root  950 ago 16 18:48 miosito
-rw-r--r-- 1 root root  950 ago 16 19:48 miosito0
-rw-r--r-- 1 root root  972 ago 17 10:57 miosito1
-rw-r--r-- 1 root root  950 ago 17 09:01 miositojs
-rw-r--r-- 1 root root  812 ago 18 11:47 miositovirtuale
-rw-r--r-- 1 root root  973 ago 17 20:19 sitoxjs
-rw-r--r-- 1 root root  414 ago 18 15:27 webjs
-rw-r--r-- 1 root root  409 ago 18 16:57 wwwjs

Codice: Seleziona tutto

~$ sudo  sudo service apache2 reload
sudo: impossibile risolvere l'host serverubuntu32b1204
sudo: impossibile risolvere l'host serverubuntu32b1204
 * Reloading web server config apache2 


/etc/apach2/apache2.conf

Codice: Seleziona tutto

#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# 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.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# The configuration directives are grouped into three basic sections:
#  1. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "foo.log"
# with ServerRoot set to "/etc/apache2" will be interpreted by the
# server as "/etc/apache2/foo.log".
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# 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 LockFile documentation (available
# at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);
# 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.
#
LockFile ${APACHE_LOCK_DIR}/accept.lock

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

##
## Server-Pool Size Regulation (MPM specific)
## 

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
#              graceful restart. ThreadLimit can only be changed by stopping
#              and starting Apache.
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_event_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

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

#
# 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. 
#
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy all
</Files>

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
# It is also possible to omit any default MIME type and let the
# client's browser guess an appropriate action instead. Typically the
# browser will decide based on the file's extension then. In cases
# where no good assumption can be made, letting the default MIME type
# unset is suggested  instead of forcing the browser to accept
# incorrect  metadata.
#
DefaultType None


#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., http://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 number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

# Include module configuration:
Include mods-enabled/*.load
Include mods-enabled/*.conf

# Include all the user configurations:
Include httpd.conf

# Include ports listing
Include ports.conf

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
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
Include conf.d/

# Include the virtual host configurations:
Include sites-enabled/
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# 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.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# The configuration directives are grouped into three basic sections:
#  1. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "foo.log"
# with ServerRoot set to "/etc/apache2" will be interpreted by the
# server as "/etc/apache2/foo.log".
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# 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 LockFile documentation (available
# at <URL:http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile>);
# 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.
#
LockFile ${APACHE_LOCK_DIR}/accept.lock

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

##
## Server-Pool Size Regulation (MPM specific)
## 

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
#              graceful restart. ThreadLimit can only be changed by stopping
#              and starting Apache.
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_event_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

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

#
# 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. 
#
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy all
</Files>

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
# It is also possible to omit any default MIME type and let the
# client's browser guess an appropriate action instead. Typically the
# browser will decide based on the file's extension then. In cases
# where no good assumption can be made, letting the default MIME type
# unset is suggested  instead of forcing the browser to accept
# incorrect  metadata.
#
DefaultType None


#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., http://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 number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

# Include module configuration:
Include mods-enabled/*.load
Include mods-enabled/*.conf

# Include all the user configurations:
Include httpd.conf

# Include ports listing
Include ports.conf

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
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
Include conf.d/

# Include the virtual host configurations:
Include sites-enabled/
Ultima modifica di vor_paul il giovedì 21 agosto 2014, 9:08, modificato 1 volta in totale.
Avatar utente
jackynet92
Moderatore Globale
Moderatore Globale
Messaggi: 13413
Iscrizione: sabato 3 settembre 2011, 1:41
Desktop: Mate
Distribuzione: Ubuntu 16.04 64bit
Sesso: Maschile
Località: Torino

Re: sito su server ubuntu 12.04 funziona solo se in /var/w

Messaggio da jackynet92 »

Avevi inserito i code in modo errato. Ho corretto io. Ricordati di scrivere

Codice: Seleziona tutto

 sempre tutto unito, senza spazi o a capo
nextpic79
Prode Principiante
Messaggi: 153
Iscrizione: domenica 12 gennaio 2014, 16:45

Re: sito su server ubuntu 12.04 funziona solo se in /var/w

Messaggio da nextpic79 »

Io ho creato molti virtual host nel mio server con ubuntu 12.04 (ora sono passato alla 14.04 ed ho un pò di problemi....), non ho fatto tutti quei passaggi ma da quello che vedo non hai abilitato i virtual host su apache conil comando

Codice: Seleziona tutto

sudo a2ensite miosito.test
.
Ti elenco i passaggi che ho fatto io:

Codice: Seleziona tutto

sudo mkdir -p /var/www/miosito1.test/public_html
sudo mkdir -p /var/www/miosito1.test/logs
sudo chown -R nomeutente:www-data /var/www/miosito1.test/public_html
sudo chmod -R 755 /var/www/miosito1.test
sudo cp /etc/apache2/sites-available/000-default /etc/apache2/sites-available/miosito1.test
sudo nano /etc/apache2/sites-available/miosito1.test
Ho scritto il virtual host:

Codice: Seleziona tutto

<VirtualHost *:80>
        ServerAdmin webmaster@miosito1.test
        ServerName miosito1.test
        ServerAlias www.miosito1.test
        DocumentRoot /var/www/miosito1.test/public_html
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/miosito1.test/public_html/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/www/miosito1.test/logs/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
 	LogLevel warn

        CustomLog /var/www/miosito1.test/logs/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
in utlimo

Codice: Seleziona tutto

sudo a2ensite miosito1.test
sudo service apache2 reload
sudo service apache2 restart
Spero ti sia utile
vor_paul
Prode Principiante
Messaggi: 86
Iscrizione: lunedì 10 marzo 2008, 17:32

Re: sito su server ubuntu 12.04 funziona solo se in /var/w

Messaggio da vor_paul »

grazie, è vero che non ho riportato il comando

Codice: Seleziona tutto

    sudo a2ensite miosito.test
ma ho riportato il risultato

Codice: Seleziona tutto

    ~$ ls /etc/apache2/sites-enabled/
    wwwjs
vedo che oltre al reload di apache hai dato anche il comando restart chde io non ho dato.

Codice: Seleziona tutto

    sudo a2ensite miosito1.test
    sudo service apache2 reload
    sudo service apache2 restart
non ho capito a cosa serve la cartella /var/www/miosito1.test/public_html
i files del sito vanno messi in miosito1.test o in public_html?
È obbligatorio mettere tutto in /var/www/miosito.. o si può mettere anche inqualsiasi cartella, come nella /home/utente/miosito.. ?
Nel tuo esempio, come richiami il tuo sito dal browser?
http://miosito1.test/index.html
oppure
http://IPserver/miosito.test/index.html

Ancora grazie
danilo
nextpic79
Prode Principiante
Messaggi: 153
Iscrizione: domenica 12 gennaio 2014, 16:45

Re: sito su server ubuntu 12.04 funziona solo se in /var/w

Messaggio da nextpic79 »

Di default i virtual host risiedono in /var/www/ ma nulla vieta di metterli altrove, l'importante è configurare correttamente il virtual host.
I file del sito io li metto, per convenzione in public_html, ma anche qui puoi variarlo purché configuri il tutto in modo corretto.
I file index.html come index.php vengono richiamati automanticmente dal server.
vor_paul
Prode Principiante
Messaggi: 86
Iscrizione: lunedì 10 marzo 2008, 17:32

Re: sito su server ubuntu 12.04 funziona solo se in /var/w

Messaggio da vor_paul »

Ho creato un nuovo sito(sitojs) copiando esattamente(spero) (tranne il nome) il tuo esempio.
tutto bene fino al comand odi restart, che fallisce con il messaggio:
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
ho seguito questa guida:

Written by Guillermo Garron .

modificando /etc/apache2/httpd.conf e creando /etc/hostname e /etc/apache2/conf.d/servername.conf , sia con ServerName localhost che con ServerName ilnome del mio server,
ma senza risolvere niente. È solo cambiato il messaggio del restart, che ora è:

Codice: Seleziona tutto

:~$  sudo service apache2 restart
sudo: impossibile risolvere l'host serverubuntu32b1204
 * Restarting web server apache2                                                Action 'start' failed.
The Apache error log may have more information.
                                                                         [fail]
ma i logs di apache
/var/log/apache2/error.log.1
e
/var/log/apache2/error.log

riportano messaggi solo fino ad ieri.

ho guardato questo post :
Stack Overflow
e tanti altri, senza risultato.
Ho stoppato il server con stop, poi l'ho riavviato con start, ma ho riceevuto lo stesso errore .
Quindi ho spento fisicamente il server, dopo la riaccensione, il restart è andato a buon fine.
ma non riesco visualizzare il sito.
ho notato una cosa strana:

Codice: Seleziona tutto

:~$ ls /etc/apache2/sites-enabled
sitojs  wwwjs
qui i miei siti sembrano abilitati,
ma se cerco di disabilitarli, non li trova!:

Codice: Seleziona tutto

:~$ sudo a2dismod wwwjs
sudo: impossibile risolvere l'host serverubuntu32b1204
ERROR: Module wwwjs does not exist!
danilo@serverubuntu32b1204:~$ sudo a2dismod sitojs
sudo: impossibile risolvere l'host serverubuntu32b1204
ERROR: Module sitojs does not exist!

se lancio i comandi senza nome, vedo tante cose, meno i miei siti:

Codice: Seleziona tutto

:~$ sudo a2dismod
sudo: impossibile risolvere l'host serverubuntu32b1204
[sudo] password for danilo: 
Your choices are: alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex cgi deflate dir env mime negotiation php5 reqtimeout setenvif status
Which module(s) do you want to disable (wildcards ok)?
:~$ sudo  a2enmod
sudo: impossibile risolvere l'host serverubuntu32b1204
Your choices are: actions alias asis auth_basic auth_digest authn_alias authn_anon authn_dbd authn_dbm authn_default authn_file authnz_ldap authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cern_meta cgi cgid charset_lite dav dav_fs dav_lock dbd deflate dir disk_cache dump_io env expires ext_filter file_cache filter headers ident imagemap include info ldap log_forensic mem_cache mime mime_magic negotiation php5 proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy_scgi reqtimeout rewrite setenvif speling ssl status substitute suexec unique_id userdir usertrack version vhost_alias
Which module(s) do you want to enable (wildcards ok)?
mi aspettavo di vedere tra le scelte i nomi dei siti presenti tra i siti disponibili:

Codice: Seleziona tutto

:~$ ls /etc/apache2/sites-available
default      miosito   miosito1   miositovirtuale  sitoxjs  wwwjs
default-ssl  miosito0  miositojs  sitojs           webjs
inoltre non riesco neanche aa abilitare il sito:

Codice: Seleziona tutto

:~$ sudo  a2enmod  miositovirtuale
sudo: impossibile risolvere l'host serverubuntu32b1204
ERROR: Module miositovirtuale does not exist!
danilo@serverubuntu32b1204:~$ sudo  a2enmod  sitojs
sudo: impossibile risolvere l'host serverubuntu32b1204
ERROR: Module sitojs does not exist!
danilo@serverubuntu32b1204:~$ sudo  a2enmod  webjs
sudo: impossibile risolvere l'host serverubuntu32b1204
ERROR: Module webjs does not exist!

Codice: Seleziona tutto

:~$ ls /etc/apache2/sites-enabled
sitojs  wwwjs
Sto i pensando se è il caso di reinnstallare tutto il server, e ricominciare da capo.
stanotte ci penserò.

grazie per il tempo che mi hai dedicato.
danilo
nextpic79
Prode Principiante
Messaggi: 153
Iscrizione: domenica 12 gennaio 2014, 16:45

Re: sito su server ubuntu 12.04 funziona solo se in /var/w

Messaggio da nextpic79 »

il messaggio "apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName" è diciamoun avvertimento non è un errore.
Ti conviene reinstallare tutto se non hai già caricato molti dati.
vor_paul
Prode Principiante
Messaggi: 86
Iscrizione: lunedì 10 marzo 2008, 17:32

Re: sito su server ubuntu 12.04 funziona solo se in /var/w

Messaggio da vor_paul »

Bene, ho reinstallato tutto, e ora funzionicchia.
_Non come avevo previsto io, ma è vivo.
hocercato di creare un VH named based seguendo il wiki Server Web VH Name based
e il tuo esempio.

nella mia home ho creato la cartella /www, nella quale ho coppiato le cartelle che contengono i mie siti:

Codice: Seleziona tutto

:~/www$ ls -l
totale 16
drwxr-xr-x 6 danilo danilo 4096 ago 20 22:13 albero
drwxr-xr-x 2 danilo danilo 4096 ago 20 17:15 BianciD
drwxr-xr-x 2 danilo danilo 4096 ago 20 18:19 logs
drwxr-xr-x 2 danilo danilo 4096 ago 20 22:16 sitojs
ho creato il file
/etc/apache2/sites-available/miositovirtuale

Codice: Seleziona tutto

:~$ cat /etc/apache2/sites-available/miositovirtuale
Listen 192.168.1.232
NameVirtualHost 192.168.1.24

<VirtualHost 192.168.1.24>
        ServerAdmin webmaster@www
	ServerName sitojs
        ServerAlias www.sitojs
	DocumentRoot /home/danilo/www/sitojs
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/danilo/www/sitojs/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>
        ErrorLog /home/danilo/www/logs/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
    LogLevel warn

        CustomLog /home/danilo/www/logs/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    </VirtualHost>

<VirtualHost 192.168.1.24>
        ServerAdmin webmaster@www
	ServerName albero
        ServerAlias www.albero
	DocumentRoot /home/danilo/www/albero
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/danilo/www/albero/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>
        ErrorLog /home/danilo/www/logs/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
    LogLevel warn

        CustomLog /home/danilo/www/logs/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>


</VirtualHost>


<VirtualHost 192.168.1.24>
        ServerAdmin webmaster@www
	ServerName BianciD
        ServerAlias www.BianciD
	DocumentRoot /home/danilo/www/BianciD
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/danilo/www/BianciD/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>
        ErrorLog /home/danilo/www/logs/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
    LogLevel warn

        CustomLog /home/danilo/www/logs/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>


</VirtualHost>


H o creato il file /etc/hosts

Codice: Seleziona tutto

:~$ cat /etc/hosts
192.168.1.24  sitojs
192.168.1.24  albero
192.168.1.24  BianciD

Ho abilitato vmiositovituale con il comando

Codice: Seleziona tutto

sudo a2ensite miositovirtuale
ho controllato che sia stato abilitato:

Codice: Seleziona tutto

:~$ sudo a2dissite
sudo: impossibile risolvere l'host serverubuntu32b1204
Your choices are: default miositovirtuale
Which site(s) do you want to disable (wildcards ok)?

quindi ho provato richiamando sul browser :

se li richiamo con il solo Ip del server, viene visualizzato l'index.html del primo sito presente sul file miositovirtuale, in questo caso sitojs.
sitojs works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.
se li richiamo con Ip del server/nome del sito, ottengo il Not Found
Not Found

The requested URL /sitojs was not found on this server.
Apache/2.2.22 (Ubuntu) Server at 192.168.1.24 Port 80

Quindi per ora metto il RISOLTO, ma aprirò una nuova discussione per capire come fare a richiamare i tre siti.

grazie ancora
danilo
vor_paul
Prode Principiante
Messaggi: 86
Iscrizione: lunedì 10 marzo 2008, 17:32

Re: sito su server ubuntu 12.04 funziona solo se in /var/w

Messaggio da vor_paul »

metterei volentieri il RISOLTO, se sapessi come si fa, lascio il compito al moderatore. scusatemi.
Avatar utente
jackynet92
Moderatore Globale
Moderatore Globale
Messaggi: 13413
Iscrizione: sabato 3 settembre 2011, 1:41
Desktop: Mate
Distribuzione: Ubuntu 16.04 64bit
Sesso: Maschile
Località: Torino

Re: sito su server ubuntu 12.04 funziona solo se in /var/w

Messaggio da jackynet92 »

Se ritieni risolto il problema, modifica il titolo del primo post aggiungendo all'inizio [Risolto].

Se vuoi puoi installare questo script che ti aggiunge un pulsante che ti permette di mettere [Risolto] con un solo click.

Non siamo noi mod a mettere i vari [Risolto]
vor_paul
Prode Principiante
Messaggi: 86
Iscrizione: lunedì 10 marzo 2008, 17:32

Re: [Risolto] sito su server ubuntu 12.04 funziona solo se

Messaggio da vor_paul »

grazie!
Avatar utente
jackynet92
Moderatore Globale
Moderatore Globale
Messaggi: 13413
Iscrizione: sabato 3 settembre 2011, 1:41
Desktop: Mate
Distribuzione: Ubuntu 16.04 64bit
Sesso: Maschile
Località: Torino

Re: [Risolto] sito su server ubuntu 12.04 funziona solo se

Messaggio da jackynet92 »

Figurati. Alla prossima :ciao:
Scrivi risposta

Ritorna a “Ubuntu su server”

Chi c’è in linea

Visualizzano questa sezione: Majestic-12 [Bot] e 12 ospiti