Strona 1 z 1
apache2 uruchamienie strony przez adres ip
: 28 wrz 2013, 10:01
autor: scorch2
Witam
Mam serwer na Apache2 ze swoją stroną w formacie np.
http://www.przykladowastrona.pl Chciałbym aby po wpisaniu w przeglądarce adresu ip np. 1.3.9.9 serwera na którym jest uruchomiona strona automatycznie była uruchamiana. Umieściłem numer ip w deklaracji pliku z konfiguracją strona ale nadal nie funkcjonuje tak jak chciałbym.
Kod: Zaznacz cały
<VirtualHost 1.3.9.9:80>
ServerName www.przykladowastrona.pl
Re: apache2 uruchamienie strony przez adres ip
: 28 wrz 2013, 17:22
autor: Hadret
Masz tam więcej adresów IP i vhostów? Bo jeśli nie, to może takie coś ci styknie:
Kod: Zaznacz cały
Listen 80
# This is the "main" server running on 172.20.30.40
ServerName server.example.com
DocumentRoot /www/mainserver
<VirtualHost 172.20.30.50>
DocumentRoot /www/example1
ServerName www.example.com
# Other directives here ...
</VirtualHost>
<VirtualHost 172.20.30.50>
DocumentRoot /www/example2
ServerName www.example.org
# Other directives here ...
</VirtualHost>
Za:
http://httpd.apache.org/docs/current/vh ... mples.html
Jeśli masz jeden adres IP, jedną domenę i jeden vhost, to nie musisz definiować mu adresu na poziomie vhosta, wystarczy port ( a więc *:80), czyli:
Kod: Zaznacz cały
Listen 80
<VirtualHost *:80>
DocumentRoot /www/przykladowastrona
ServerName http://www.przykladowastrona.pl
# Reszta konfiguracji
</VirtualHost>
Re: apache2 uruchamienie strony przez adres ip
: 30 wrz 2013, 08:09
autor: scorch2
Problem w tym że Mam na jednym ip dwie wersje tej samej strony po http i https
Kod: Zaznacz cały
<VirtualHost 1.3.9.9:80>
ServerName www.przykladowastrona.pl
ServerAlias przykladowastrona.pl
DocumentRoot /srv/httpd/przykladowastrona
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost 1.3.9.9:443>
ServerName www.przykladowastrona.pl
ServerAlias przykladowastrona.pl
DocumentRoot /srv/httpd/przykladowastrona
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/strona.pl.crt
SSLCertificateKeyFile /etc/apache2/ssl/strona.pl.key
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Re: apache2 uruchamienie strony przez adres ip
: 30 wrz 2013, 10:55
autor: Ubek308
Czy strony na http i https sie roznia ?
Wątpię skoro w obu przypadkach jest ten sam "DocumentRoot /srv/httpd/przykladowastrona" <- !!!
Jesli tylko źle przedstawiles sytuacje i jednak chcesz miec dwie rozne tresci - musisz dac inny DocumentRoot dla obu protokolow.
To rzecz jasna tylko jedno z mozliwych rozwiazan, najprostsze.
Re: apache2 uruchamienie strony przez adres ip
: 30 wrz 2013, 12:13
autor: scorch2
Strony nie różnią się treścią tylko chciałem żeby działa zarówno po http jak i https
Re: apache2 uruchamienie strony przez adres ip
: 30 wrz 2013, 16:12
autor: Ubek308
To zrob:
Listen 80
Listen 443