Como eu acesso um servidor web Apache usando um nome domian em vez de IP?

0

Estou executando um servidor Apache e quero acessar meu site digitando something.somethingelse.gr em vez de 192.168.1.105.

Como posso fazer isso?

    
por Danae Vogiatzi 27.10.2016 / 15:31

2 respostas

0

Vá para a pasta /etc/apache2/sites-available e copie o arquivo 00-default.conf padrão para mysite.conf . Você pode usar qualquer nome exclusivo para o mysite.conf . Nesse caso, você poderia chamá-lo de something-somethingelse-gr.conf (para seu próprio nome pessoal, identificando sua designação para este site virtual.

Em seguida, edite sua nova configuração. Remova o comentário da diretiva ServerName e substitua o www.example.com por something.somethingelse.gr . Você também pode adicionar outros nomes para chamar o mesmo servidor usando a diretiva ServerAlias , conforme descrito abaixo.

Alterar de:

# 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

Mude para:

# 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 something.somethingelse.gr
    ServerAlias www.something.somethingelse.gr

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

Em seguida, execute isso na linha de comando:

$ a2ensite mysite.conf
    
por L. D. James 27.10.2016 / 15:49
0

A configuração de um Avahi Daemon irá mapear um "mymachine.local" para um endereço IP local, se é isso que você quer dizer.

No entanto, você precisaria fornecer mais detalhes sobre suas necessidades, caso deseje aconselhamento mais específico.

por exemplo. Isso é sobre uma rede local? É para ser acessado da internet. qual domínio de nível superior (.com .ag .ie) você quer / precisa?

    
por user98651 27.10.2016 / 15:42