Apache2 Direkten IP Zugriff blockieren?
Hey, ich würde gerne den Zugriff auf meinen Webserver nur per Domain erlauben.
Wie mache ich dies?
Danke für eure Hilfe!
1 Antwort
Nutzer, der sehr aktiv auf gutefrage ist
virtual host basteln und servername mit domain angeben .
https://httpd.apache.org/docs/2.4/vhosts/examples.html
Listen 80
<VirtualHost *:80>
DocumentRoot "/www/example1"
ServerName www.example.com
# Other directives here
</VirtualHost>
TechPech1984
14.03.2022, 13:11
@Craftingtv
kann das sein das du ein default host hast in deiner http.conf ?
https://httpd.apache.org/docs/2.4/vhosts/examples.html
du kannst auch
Migrating a name-based vhost to an IP-based vhost
The name-based vhost with the hostname
www.example.org
(from our name-based example, setup 2) should get its own IP address. To avoid problems with name servers or proxies who cached the old IP address for the name-based vhost we want to provide both variants during a migration phase.
The solution is easy, because we can simply add the new IP address (
172.20.30.50
) to the
VirtualHost
directive.
Listen 80
ServerName www.example.com
DocumentRoot "/www/example1"
@TechPech1984
Ich wüsste nich das ich eine http.conf erstellt habe/ Konfiguriert habe.
TechPech1984
14.03.2022, 13:14
@Craftingtv
du hast nicht soviel ahnung von apache2 , erst gibts mal die http.conf oder apache.conf und die ruft dann erst die site-availible und mod-availible auf .
da steht sowas wie
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path. If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used. If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "D:/xampp/apache"
#
# Mutex: Allows you to set the mutex mechanism and mutex file directory
# for individual mutexes, or change the global defaults
#
# Uncomment and change the directory if mutexes are file-based and the default
# mutex file directory is not on a local disk or is not appropriate for some
# other reason.
#
# Mutex default:logs
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
Vielen Dank für deine Antwort, genau das habe ich gemacht :). Trotzdem kann ich per IP Zdrauf kommen.