Kirjoittaja Aihe: WWW-palvelin käyttöön (Ratkaistu)  (Luettu 8999 kertaa)

nm

  • Käyttäjä
  • Viestejä: 16232
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #20 : 19.02.17 - klo:23.44 »
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 84.kkk.hhh.bb. Set the 'ServerName' directive globally to suppress this message
Syntax OK

Ilmoitus viittaa siihen että ServerName ei ole asetettu, eli asetustiedostosi ei ehkä ole kytketty käyttöön, tai oletusasetukset menevät sen edelle. Oletusasetuksilla DocumentRoot on /var/www/html. Mitä /etc/apache2/sites-enabled/ sisältää?

Koodia: [Valitse]
ls -l /etc/apache2/sites-enabled/

kx

  • Käyttäjä
  • Viestejä: 701
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #21 : 20.02.17 - klo:08.21 »
 Tuota antaa;  Eli käynnistin aamulla koneen ja tuollaista antoi:

Koodia: [Valitse]
kari@kari-HP-255-G3-Notebook-PC:~$ ls -l /etc/apache2/sites-enabled/
yhteensä 0
lrwxrwxrwx 1 root root 32 helmi 19 21:16 julkinen.conf -> ../sites-available/julkinen.conf
lrwxrwxrwx 1 root root 32 helmi 19 22:25 Julkinen.conf -> ../sites-available/Julkinen.conf
kari@kari-HP-255-G3-Notebook-PC:~$



Kun asetteluna on nyt tuo:  (Muutin sen IP:stä tähän)

Koodia: [Valitse]

ServerAdmin admin@julkinen
    ServerName julkinen
    ServerAlias kari.julkinen
    DocumentRoot /home/kari/julkinen/public_html

Ja konfitest antaa entisen virheen, jossa on viittaus IP-numeroon eli jossain on se asetus päällimmäisenä ja varmaan perua ekasta asennuksesta.


« Viimeksi muokattu: 20.02.17 - klo:08.52 kirjoittanut kx »
HP Pro Intel i5-3470 core 4  3,2,Hz RAM 8 Gb+Kingston 240Gt SSD+ nVidia Gt730+Ubuntu 22.04 lts + W10Pro64-bit ja Samsung ML-2165 sekä CanoScan Lide300

nm

  • Käyttäjä
  • Viestejä: 16232
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #22 : 20.02.17 - klo:09.22 »
lrwxrwxrwx 1 root root 32 helmi 19 21:16 julkinen.conf -> ../sites-available/julkinen.conf
lrwxrwxrwx 1 root root 32 helmi 19 22:25 Julkinen.conf -> ../sites-available/Julkinen.conf

Poista varmuuden vuoksi linkki Julkinen.conf -tiedostoon, kun sitä konfiguraatiota ei nyt tarvita:

Koodia: [Valitse]
sudo rm /etc/apache2/sites-enabled/Julkinen.conf
Koodia: [Valitse]
ServerAdmin admin@julkinen
    ServerName julkinen
    ServerAlias kari.julkinen
    DocumentRoot /home/kari/julkinen/public_html

Siellä konfitiedostossa pitäisi olla myös VirtualHosts-tagit. Näytä vielä koko tiedoston  sisältö:

Koodia: [Valitse]
cat /etc/apache2/sites-enabled/julkinen.conf

kx

  • Käyttäjä
  • Viestejä: 701
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #23 : 20.02.17 - klo:09.34 »
poistin linkin ja näytän tässä

Koodia: [Valitse]
kari@kari-HP-255-G3-Notebook-PC:~$ sudo rm /etc/apache2/sites-enabled/Julkinen.conf
[sudo] salasana henkilölle kari:
kari@kari-HP-255-G3-Notebook-PC:~$ cat /etc/apache2/sites-enabled/julkinen.conf
<VirtualHost *: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 admin@julkinen

    ServerName julkinen
    ServerAlias kari.julkinen
    DocumentRoot /home/kari/julkinen/public_html

# 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


ja nämä on näin nyt:

Koodia: [Valitse]
kari@kari-HP-255-G3-Notebook-PC:~$ ls -l /etc/apache2/sites-enabled/
yhteensä 0
lrwxrwxrwx 1 root root 32 helmi 19 21:16 julkinen.conf -> ../sites-available/julkinen.conf
kari@kari-HP-255-G3-Notebook-PC:~$ ls -ld /home/kari/julkinen
drwxr-xr-x 3 kari kari 4096 helmi 19 21:06 /home/kari/julkinen
kari@kari-HP-255-G3-Notebook-PC:~$
« Viimeksi muokattu: 20.02.17 - klo:10.03 kirjoittanut kx »
HP Pro Intel i5-3470 core 4  3,2,Hz RAM 8 Gb+Kingston 240Gt SSD+ nVidia Gt730+Ubuntu 22.04 lts + W10Pro64-bit ja Samsung ML-2165 sekä CanoScan Lide300

nm

  • Käyttäjä
  • Viestejä: 16232
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #24 : 20.02.17 - klo:13.39 »
Jep, näyttää ihan hyvältä. Käynnistä sitten Apache uudelleen:

Koodia: [Valitse]
sudo systemctl restart apache2
Jos ei vieläkään lähde toimimaan, voisi seuraavaksi katsoa Apachen lokitiedostoista lisätietoja 403-virheestä:

Koodia: [Valitse]
cat /var/log/apache2/access.log
Koodia: [Valitse]
cat /var/log/apache2/error.log

kx

  • Käyttäjä
  • Viestejä: 701
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #25 : 20.02.17 - klo:13.45 »
Näyttää näin:

Koodia: [Valitse]
kari@kari-HP-255-G3-Notebook-PC:~$ sudo apache2ctl configtest
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 84.. Set the 'ServerName' directive globally to suppress this message
Syntax OK
kari@kari-HP-255-G3-Notebook-PC:~$ cat /var/log/apache2/access.log
84. - - [20/Feb/2017:09:02:54 +0200] "GET / HTTP/1.1" 403 505 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"
84.2 - - [20/Feb/2017:09:02:54 +0200] "GET /favicon.ico HTTP/1.1" 403 515 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"
84.2 - - [20/Feb/2017:09:02:54 +0200] "GET /favicon.ico HTTP/1.1" 403 515 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"
84.2 - - [20/Feb/2017:11:02:09 +0200] "GET / HTTP/1.1" 403 505 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"
84.2 - - [20/Feb/2017:11:02:09 +0200] "GET /favicon.ico HTTP/1.1" 403 515 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"
84.2 - - [20/Feb/2017:11:02:09 +0200] "GET /favicon.ico HTTP/1.1" 403 515 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"
191.96.249.42 - - [20/Feb/2017:11:07:42 +0200] "GET /phpmyadmin/scripts/setup.php HTTP/1.0" 403 491 "-" "-"
84.2 - - [20/Feb/2017:13:42:32 +0200] "GET / HTTP/1.1" 403 505 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"
84. - - [20/Feb/2017:13:42:32 +0200] "GET /favicon.ico HTTP/1.1" 403 515 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"
84. - - [20/Feb/2017:13:42:32 +0200] "GET /favicon.ico HTTP/1.1" 403 515 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0"
kari@kari-HP-255-G3-Notebook-PC:~$


ja tällaista:  Serverin nimenä on ollut nyt "julkinen"
 eilisestä asti

Koodia: [Valitse]
kari@kari-HP-255-G3-Notebook-PC:~$ cat /var/log/apache2/error.log
[Mon Feb 20 08:15:32.686951 2017] [mpm_event:notice] [pid 1498:tid 140110145410944] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Mon Feb 20 08:15:32.687005 2017] [core:notice] [pid 1498:tid 140110145410944] AH00094: Command line: '/usr/sbin/apache2'
[Mon Feb 20 09:02:54.750279 2017] [authz_core:error] [pid 3358:tid 140110030198528] [client 84.:54503] AH01630: client denied by server configuration: /home/kari/Julkinen/public_html/
[Mon Feb 20 09:02:54.817576 2017] [authz_core:error] [pid 3358:tid 140110038591232] [client 84.:54503] AH01630: client denied by server configuration: /home/kari/Julkinen/public_html/favicon.ico
[Mon Feb 20 09:02:54.844942 2017] [authz_core:error] [pid 3358:tid 140109953365760] [client 84.:54503] AH01630: client denied by server configuration: /home/kari/Julkinen/public_html/favicon.ico
[Mon Feb 20 11:02:09.335297 2017] [authz_core:error] [pid 3358:tid 140109944973056] [client 84.:53877] AH01630: client denied by server configuration: /home/kari/Julkinen/public_html/
[Mon Feb 20 11:02:09.412053 2017] [authz_core:error] [pid 3358:tid 140109936580352] [client :53877] AH01630: client denied by server configuration: /home/kari/Julkinen/public_html/favicon.ico
[Mon Feb 20 11:02:09.438247 2017] [authz_core:error] [pid 3358:tid 140109928187648] [client 84.:53877] AH01630: client denied by server configuration: /home/kari/Julkinen/public_html/favicon.ico
[Mon Feb 20 11:07:42.156821 2017] [authz_core:error] [pid 3358:tid 140109919794944] [client 191.96.249.42:35488] AH01630: client denied by server configuration: /home/kari/Julkinen/public_html/phpmyadmin
[Mon Feb 20 13:41:18.118591 2017] [mpm_event:notice] [pid 1498:tid 140110145410944] AH00491: caught SIGTERM, shutting down
[Mon Feb 20 13:41:19.320789 2017] [mpm_event:notice] [pid 7508:tid 140181643941760] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Mon Feb 20 13:41:19.321085 2017] [core:notice] [pid 7508:tid 140181643941760] AH00094: Command line: '/usr/sbin/apache2'
[Mon Feb 20 13:42:32.368689 2017] [authz_core:error] [pid 7511:tid 140181491414784] [client 84.:54488] AH01630: client denied by server configuration: /home/kari/julkinen/public_html/
[Mon Feb 20 13:42:32.443435 2017] [authz_core:error] [pid 7511:tid 140181483022080] [client 84.:54488] AH01630: client denied by server configuration: /home/kari/julkinen/public_html/favicon.ico
[Mon Feb 20 13:42:32.464920 2017] [authz_core:error] [pid 7511:tid 140181474629376] [client 84.:54488] AH01630: client denied by server configuration: /home/kari/julkinen/public_html/favicon.ico
kari@kari-HP-255-G3-Notebook-PC:~$
« Viimeksi muokattu: 21.02.17 - klo:10.12 kirjoittanut kx »
HP Pro Intel i5-3470 core 4  3,2,Hz RAM 8 Gb+Kingston 240Gt SSD+ nVidia Gt730+Ubuntu 22.04 lts + W10Pro64-bit ja Samsung ML-2165 sekä CanoScan Lide300

nm

  • Käyttäjä
  • Viestejä: 16232
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #26 : 20.02.17 - klo:16.21 »
Okei, täytyy sallia pääsy tuonne hakemistoon Directory-säännöllä:

Koodia: [Valitse]
<Directory /home/kari/julkinen/public_html>
    Options Indexes FollowSymlinks
    AllowOverride None
    Require all granted
</Directory>

Sen voi lisätä vaikka julkinen.conf-tiedostoon VirtualHost-konfiguraation sisään:

Koodia: [Valitse]
<VirtualHost *: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 admin@julkinen

ServerName julkinen
ServerAlias kari.julkinen
DocumentRoot /home/kari/julkinen/public_html

<Directory /home/kari/julkinen/public_html>
Options Indexes FollowSymlinks
AllowOverride None
Require all granted
</Directory>

# 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>

/etc/apache2/apache2.conf-tiedostossa on vastaavat säännöt /var/www-hakemistolle. Homma toimi aiemmin ilman tätä säätöä, koska sivustosi oli /var/www:n alla esimerkki.com-hakemistossa.

mrl586

  • Käyttäjä
  • Viestejä: 4638
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #27 : 20.02.17 - klo:16.39 »
Eikös palvelimen nimi pitäisi lisätä myös IP-numeron kanssa /etc/hosts-tiedostoon, ettei Apache valittaisi FQDN:n puuttumisesta?

kx

  • Käyttäjä
  • Viestejä: 701
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #28 : 20.02.17 - klo:16.42 »
Ok, nyt pääsin ilmeisesti oikeaan julkinen- kansioon, mutta näkyy vain tiedoston nimi näytöllä eli index.html.
Vielä pitäisi saada tiedoston sisältö näkyviin. Miten se onnistuu?
Sisältö on tehty bluegriffonilla .
 

host-tiedosto on tällainen:

Koodia: [Valitse]
192.                  localhost
84.                      kari-HP-255-G3-Notebook-PC
111.111.111.111 julkinen
« Viimeksi muokattu: 20.02.17 - klo:17.10 kirjoittanut kx »
HP Pro Intel i5-3470 core 4  3,2,Hz RAM 8 Gb+Kingston 240Gt SSD+ nVidia Gt730+Ubuntu 22.04 lts + W10Pro64-bit ja Samsung ML-2165 sekä CanoScan Lide300

nm

  • Käyttäjä
  • Viestejä: 16232
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #29 : 20.02.17 - klo:16.46 »
Ok, nyt pääsin ilmeisesti oikeaan julkinen- kansioon, mutta näkyy vain tiedoston nimi näytöllä eli index.html.

Onhan se nyt tiedosto eikä hakemisto?

Koodia: [Valitse]
ls -ld /home/kari/julkinen/public_html/index.html
Jos on tiedosto, mitä se sisältää?

Koodia: [Valitse]
cat /home/kari/julkinen/public_html/index.html

kx

  • Käyttäjä
  • Viestejä: 701
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #30 : 20.02.17 - klo:16.49 »
tällainen on

Koodia: [Valitse]
kari@kari-HP-255-G3-Notebook-PC:~$ ls -ld /home/kari/julkinen/public_html/index.html
-rw-rw-r-- 1 kari kari 129 helmi 19 21:49 /home/kari/julkinen/public_html/index.html
kari@kari-HP-255-G3-Notebook-PC:~$


ja tällainen

Koodia: [Valitse]
<html>
  <head>
    <title> Terve </title>
  </head>
  <body>
    <h1> index.html </h1>
  </body>
</html>
« Viimeksi muokattu: 20.02.17 - klo:16.51 kirjoittanut kx »
HP Pro Intel i5-3470 core 4  3,2,Hz RAM 8 Gb+Kingston 240Gt SSD+ nVidia Gt730+Ubuntu 22.04 lts + W10Pro64-bit ja Samsung ML-2165 sekä CanoScan Lide300

kx

  • Käyttäjä
  • Viestejä: 701
    • Profiili
Vs: WWW-palvelin käyttöön
« Vastaus #31 : 20.02.17 - klo:17.30 »
Oho, vasta nyt vihdoin hokasin virheeni. Minulla oli julkinen-kansiossa tiedosto index.html sekä kansio public_html , jonka sisällä oli myöskin index.html tiedosto.  Eli sivu otettiinkin tuon public-kansion sisältä. Nyt siirsin tuon "oikeaa sisältöä" olevan index.html:n tuonne publicin sisään, niin jo alkoi näyttää oikeaa sivua.

Suuret kiitokset kaikille osallistuneille, ja erityisesti jäsenelle nm!
HP Pro Intel i5-3470 core 4  3,2,Hz RAM 8 Gb+Kingston 240Gt SSD+ nVidia Gt730+Ubuntu 22.04 lts + W10Pro64-bit ja Samsung ML-2165 sekä CanoScan Lide300