Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

4 strony - 1 serwer


Rekomendowane odpowiedzi

Opublikowano

Mam serwer VPS i 4 domeny. Chcę postawić 4 strony. Zrobiłem 4 katalogi - każdy z nich to inna strona. Domeny są podpięte pod serwer.

Jednak po wejściu na każdą z domen nie pojawia się jej zawartość tylko do wyboru są te foldery.

Co zrobić by przekierować domenę 1 na folder 1, domenę 2 na folder 2 itd. 

Zawsze mam problem z takimi rzeczami, niech mi ktoś wytłumaczy najprościej jak się da co zrobić by to działało normalnie.

 

243423434.png

1398258449-U383457.png

Opublikowano

wchodzisz w /etc/apache2/sites-available i kopiujesz defaultowy config do /etc/apache2/sites-enabled

Robisz 4 takie configi o wybranych nazwach np moja-strona.conf, 2strona.conf etc.

każdy taki config powinien mieć mniej więcej taką treść: 

<VirtualHost DOMENA:80>										<-----------------------------
	# 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/KATALOG								<-----------------------------

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

W zaznaczonych miejscach musisz wpisac DOMENA - domenę pod jaką strona ma się wyświetlać (o ile oczywiście takowe posiadasz i przekierowałeś) np. moja-strona.pl 

oraz KATALOG - nazwę katalogu umiejscowionego w /var/www np strona1

Pamiętaj by usunąć te strzałki xD

 

jeżeli nie posiadasz domeny CHYBA możesz po prostu dać tam ip serwera ze slashem np. 92.150.27.40/strona1

na koniec musisz wykonać komendę service apache2 restart i powinno śmigać

więcej znajdziesz tutaj https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts

= SygnaturA =

Made by... ME. 

 

Opublikowano
30 minut temu, Damian_RastMan napisał:

wchodzisz w /etc/apache2/sites-available i kopiujesz defaultowy config do /etc/apache2/sites-enabled

Robisz 4 takie configi o wybranych nazwach np moja-strona.conf, 2strona.conf etc.

każdy taki config powinien mieć mniej więcej taką treść: 


<VirtualHost DOMENA:80>										<-----------------------------
	# 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/KATALOG								<-----------------------------

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

W zaznaczonych miejscach musisz wpisac DOMENA - domenę pod jaką strona ma się wyświetlać (o ile oczywiście takowe posiadasz i przekierowałeś) np. moja-strona.pl 

oraz KATALOG - nazwę katalogu umiejscowionego w /var/www np strona1

Pamiętaj by usunąć te strzałki xD

 

jeżeli nie posiadasz domeny CHYBA możesz po prostu dać tam ip serwera ze slashem np. 92.150.27.40/strona1

na koniec musisz wykonać komendę service apache2 restart i powinno śmigać

więcej znajdziesz tutaj https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts

musi podać tam domeny bo o to mu właśnie chodzi, aby każda domena miała własny katalog a nie wszystkie jeden.

Co do samego tematu to wystarczy do tego pliku dla każdej strony podać taką deklarację:

<VirtualHost *:80>
    DocumentRoot "/www/katalogstrony"
    ServerName www.domena.org
</VirtualHost>

Jeżeli chcesz dokładniejszy opis działania vHost'ów to zapraszam do tego linku https://httpd.apache.org/docs/2.4/vhosts/examples.html

(')(.)(;)

  • Mr.Mxn zablokował(a) ten temat

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...