Il Blog di Fabrizio Mondo

Configurazione di Gnump3d su Linux, Basic Server Settings

novembre 11, 2007 4:52 pm

Paper sheet
Quarantaquattresimo articolo dedicato alle web radio.

Dopo la parentesi dovuta ai mime types e all’elenco delle estensioni supportate, passiamo al file di configurazione vero e proprio, ovvero gnump3d.conf.

Andremo parte per parte, in modo da avere ben chiaro tutto. Questo articolo si dedicherà soltanto ai settaggi basilari del server.

PREMESSA: una riga che comincia per # rappresenta un commento.

# The port upon which we are going to serve. This may be any
# port which is not already in use upon your machine.
#
# You may use a low port, for example 80, if you are running
# as root – but that is only recommended if you make use of
# the `user’ option, which occurs later in this file.
#
port = 8888

Questa opzione identifica la porta a cui risponderà il vostro server. E’ impostata di default la porta 8888, ma potete impostare at your own risk anche la 80. Soprattutto se volete che questo server sia accessibile in modo semplice, magari con un alias DNS.

# The following is the interface address that we wish to
# bind upon.
#
# You’ll only need set this if you are running this server upon
# a machine which has multiple IP addresses and you wish to force
# it to bind to a particular address.
#
# If you’re not running this server on a machine with multiple
# IP addresses, then please ignore this setting.
#
#
# NOTE
######
#
# If you just want to specify the name used in all the generated
# links then you should be setting `hostname’ instead.
#
# binding_host = 192.168.1.2

Questa opzione è utile soltanto nel caso in cui la macchina che ospita il server ha più di un indirizzo ip disponibile e si vuole forzare l’utilizzo di un particolare ip locale. Io ho provato a decommentare il binding_host impostando il mio ip locale. Una volta messa questa impostazione, il server risponde non solo dall’indirizzo 127.0.0.1 ma anche dall’ip locale.

# Set the hostname that is used in all the generated links.
#
# (This defaults to the name of the server machine, with no
# domain suffix).
#
# You won’t need this unless the machine which is serving on
# MUST be accessed via its fully qualified domain name – for
# example if you’re running it on a machine which is accessible
# to the world.
#
# NOTE
######
#
# See `binding_host’ if you have a machine which has multiple
# IP addresses and you’re trying to bind to one in particular.
#
# hostname = mp3d.foo.org
#

Questa opzione è fondamentale, soprattutto qualora vogliate rendere pubblico su internet il vostro server. Oltre ovviamente a raccomandarvi di effettuare il port forwarding della porta tcp settata qualora abbiate un router firewallato, potete decommentare la riga hostname, mettendo al posto di mp3d.foo.org anche un semplice localhost. Questo per ora è sufficiente.

# The root directory where we serve content from, this should be
# the directory containing the MP3, OGG, or other media files that
# you wish to share.
#
# Obviously the files which you wish to serve should be accessible
# to the user who this server is running as – which is set via the
# ‘user’ setting below.
#
# If you’re on a multi-user system its probably a good idea to
# make the audio files readable to other users anyway, share the
# musical goodness!
#
root = /var/music

Questa opzione si limita a identificare quale sia la cartella che contiene i media files che il server permetterà di streammare. Si chiede (giustamente) che i files siano accessibili all’user che sta facendo girare il server.

#
# This is the file which logs all MP3’s / OGG’s / directories
# which clients access.
#
# If you start the server as root it’s recommended that you use
# a canonical location such as ‘/var/log’ or ‘/var/adm’, (because
# your system will, probably, rotate files held there).
#
# If you’re starting this server as a non-root user you should
# change these locations to be a directory upon which you have write
# permissions.
#

Questa è l’intestazione per la modifica del path del file di log del server gnump3d. In questo tralcio particolare, si dice che se il server non è fatto girare da root, si deve impostrare una directory con permessi di scrittura (e vorrei ben vedere). Nel caso in cui sia l’utente mammasantissima (root) a fare partire il server, si consiglia la directory impostata di default.

####
#
# IMPORTANT NOTE:
#
# If you want the song statistics to be displayed correctly
# you MUST give the logfile as an absolute path – you must also
# ensure that the logfile is readable to the user whom you are
# running the server as.
#
####

Se vuoi che le statistiche siano visualizzate correttamente, allora imposta un path assoluto e dai i permessi di lettura per l’utente che fa partire il server.

# NOTE:
#
# This logfile is 100% apache logfile compatible so you may run any
# Apache logfile processor upon it if you so wish.
#
# Simplistic statistics such as the most popular directories, songs,
# and clients are available via the installed script ‘gnump3d-top’
# Run ‘gnump3d-top –help’ for details.
#
#
####
#
logfile = /var/log/gnump3d/access.log

Esiste uno script chiamato GNUmp3d-top che fornisce statistiche. Ne parlermo in seguito.

#
# Specify the format of the logfile, this may use any valid variables
# which are defined in package “main”.
#
#
log_format = $connected_address – $user [$date] “GET $REQUEST” $HTTP_CODE $SERVED_SIZE “-” “$USER_AGENT”

E’ il formato del log. Se non si ha molta dimestichezza nella sintassi HTTP e non si conoscono i log apache, consiglio di lasciare tutto AS IS.

# In the case of problems all output from the server will be sent
# to an error log.
#
# This next option configures where that is
#
errorlog = /var/log/gnump3d/error.log

Tutte le considerazioni fatte per il file di log, valgono anche per il log d’errore.

# This option allows you to specify additional arguments to the
# statistics generating program ‘gnump3d-top’, and it’s complete
# path if you don’t have it installed upon the $PATH of the user
# who starts the server:
#
# stats_program = /usr/bin/gnump3d-top
#
#
# For example you may change the default number of lines which are
# reported from the default of 20 to 10 with this:
#
# stats_arguments = –count=10
#
# To hide the directories which are handled by the various plugins
# you may use the ‘–hide’ option.
#
# stats_arguments = –hide
#
# To read multiple logfiles, (eg to cope with files which have been
# processed by logrotate), you could use:
#
# stats_arguments = –logfiles = /var/log/gnump3d/access.log*
#
# Combine the options if you wish, and see the gnump3d-top man-page
# for details of more arguments
#
# stats_arguments = –count=40 –hide –logfiles=/var/log/gnump3d/access.log*

Tutte queste opzioni, servono per settare il programma gnump3d-top, che serve per le statistiche. Torneremo sull’argomento, quando approfondiremo il trattamento di questo programma. Sappiate per ora soltanto che è possibile settare un path per tale programma e degli argomenti da passargli, ovviamente settando e decommentando le righe opportune tra quelle scritte sopra.

Ma di questo parleremo in seguito.

Stay tuned per le altre opzioni settabili all’interno del file gnump3d.conf

3 Responses to “Configurazione di Gnump3d su Linux, Basic Server Settings”

marco wrote a comment on giugno 16, 2008

ciao, sto provando ad accedere alla musica dall’esterno della mia rete LAN (all’interno della quale il servizio funziona).

Ho aperto la porta TCP, però mi vengono chiesti nome utente e pwd, ma non saprei cosa metterci (l’unico nome utente e pwd che ho settato nel file .password all’interno della cartella degli .mp3 non funziona).

Se qualcuno riuscisse ad aiutarmi gli sarei grato!

Thanks!

Fabrizio Mondo wrote a comment on giugno 19, 2008

@Marco:

Dovresti dirmi in che occasione compaiono nome utente e password.

marco wrote a comment on giugno 25, 2008

problema risolto, non so per quale motivo ma quella porta puntava alla pagina di configurazione del mio router (perciò nome e pwd erano quelle). Ora ho cambiato porta e funziona, però l’accesso è libero.
Sai dirmi cosa devo impostare per creare degli utenti? ho creato il file .password ma non funziona…

Ciao!

Care to comment?