🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

10 total messages Started by jivanmukta Wed, 24 Jun 2015 13:37
Apache2 próbuje pobierać z /var/www zamiast ~/public_html
#408251
Author: jivanmukta
Date: Wed, 24 Jun 2015 13:37
28 lines
2795 bytes
Uczę się PHP5 i innych technologii WWW. Napisałem na localhoście witrynę w PHP5 (CodeIgniter). Otwieram ją tak: http://localhost/~robert/index.php/announcement/index i działa. Jednak chciałbym zrobić, tak żeby adres nie zawierał pliku index.php, tzn. http://localhost/~robert/announcement/index. Oczywiście announcement to controler a index to akcja.
Zrobiłem wg dokumentacji CodeIgnitera i materiałów w sieci. Tzn. ustawiłem w pliku ~/public_html/application/config/config.php:
  $config['index_page'] = ''; // 'index.php';
  $config['uri_protocol']	= 'REQUEST_URI';
Natomiast ~/public_html/.htaccess ma postać:

#v+
AuthUserFile "/home/robert/public_html/application/resources/.htpass"
AuthName "Strony zabezpieczone"
AuthType Basic
require valid-user
ErrorDocument 401 "/home/robert/public_html/denial.html"
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|robots\.txt|denial\.html|resources|captcha)
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]
#v-

Kiedy teraz wpisuję w przeglądarce adres: http://localhost/~robert/announcement/index to dostaję 

Not Found
The requested URL /index.php/announcement/index was not found on this server.

W log Apacha mam: [Wed Jun 24 15:23:59 2015] [error] [client 127.0.0.1] script '/var/www/index.php' not found or unable to stat

Moduł Userdirs mi działa, bo http://localhost/~robert/index.php/announcement/index działa. Oczywiście rewrite.load jest w katalogu /etc/apache2/mods-enabled.
Dlaczego Apache2 próbuje pobierać index.php z /var/www zamiast z ~/public_html?
Proszę o podpowiedź. Z góry dzięki!
Re: Apache2 próbuje pobierać z /var/www zamiast ~/public_html
#408252
Author: PawelS cbrbob(at)wbcd(dot)pl
Date: Wed, 24 Jun 2015 16:53
33 lines
2803 bytes
jivanmukta@poczta.onet.pl pisze:
> Uczę się PHP5 i innych technologii WWW. Napisałem na localhoście witrynę w PHP5 (CodeIgniter). Otwieram ją tak: http://localhost/~robert/index.php/announcement/index i działa. Jednak chciałbym zrobić, tak żeby adres nie zawierał pliku index.php, tzn. http://localhost/~robert/announcement/index. Oczywiście announcement to controler a index to akcja.
> Zrobiłem wg dokumentacji CodeIgnitera i materiałów w sieci. Tzn. ustawiłem w pliku ~/public_html/application/config/config.php:
>   $config['index_page'] = ''; // 'index.php';
>   $config['uri_protocol']	= 'REQUEST_URI';
> Natomiast ~/public_html/.htaccess ma postać:
> 
> #v+
> AuthUserFile "/home/robert/public_html/application/resources/.htpass"
> AuthName "Strony zabezpieczone"
> AuthType Basic
> require valid-user
> ErrorDocument 401 "/home/robert/public_html/denial.html"
> DirectoryIndex index.php
> RewriteEngine on
> RewriteCond $1 !^(index\.php|robots\.txt|denial\.html|resources|captcha)
> RewriteRule ^(.*)$ /index.php/$1 [L,QSA]
> #v-
Może spróbuj tak, zgaduję, zła konstrukcja: RewriteCond + RewriteRule:
RewriteEngine on
RewriteBase /
RewriteRule !(^index.php|^www|^lib) /index.php

> Kiedy teraz wpisuję w przeglądarce adres: http://localhost/~robert/announcement/index to dostaję 
> 
> Not Found
> The requested URL /index.php/announcement/index was not found on this server.
> 
> W log Apacha mam: [Wed Jun 24 15:23:59 2015] [error] [client 127.0.0.1] script '/var/www/index.php' not found or unable to stat
> 
> Moduł Userdirs mi działa, bo http://localhost/~robert/index.php/announcement/index działa. Oczywiście rewrite.load jest w katalogu /etc/apache2/mods-enabled.
> Dlaczego Apache2 próbuje pobierać index.php z /var/www zamiast z ~/public_html?
> Proszę o podpowiedź. Z góry dzięki!
Re: Apache2 próbuje pobierać z /var/www zamiast ~/public_html
#408253
Author: jivanmukta
Date: Wed, 24 Jun 2015 17:31
1 lines
1308 bytes
znowu not found i znowu /var/www/index.php
Re: Apache2 próbuje pobierać z /var/www zamiast ~/public_html
#408254
Author: jivanmukta
Date: Wed, 24 Jun 2015 17:40
1 lines
1493 bytes
Niczego w konfiguracji Apache'a nie zmieniałem.
Re: Apache2 próbuje pobierać z /var/www zamiast ~/public_html
#408255
Author: Borys Pogoreło
Date: Wed, 24 Jun 2015 18:16
20 lines
1589 bytes
Dnia Wed, 24 Jun 2015 06:37:57 -0700 (PDT), jivanmukta@poczta.onet.pl
napisał(a):

> RewriteEngine on
> RewriteCond $1 !^(index\.php|robots\.txt|denial\.html|resources|captcha)
> RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

A czemu w RewriteCond wyłączasz index.php? Nie wiem jak Apache, ale
lighttpd bardzo nie lubi takiej kombinacji, bo to jednocześnie blokuje
działanie samego przekierowania. 

> Kiedy teraz wpisuję w przeglądarce adres: http://localhost/~robert/announcement/index to dostaję 
> Not Found
> The requested URL /index.php/announcement/index was not found on this server.

A bez serwowania z UserDir, tylko bezpośrednio pod domeną działa?

-- 
Borys Pogoreło
borys(#)leszno,edu,pl
Re: Apache2 próbuje pobierać z /var/www zamiast ~/public_html
#408256
Author: jivanmukta
Date: Thu, 25 Jun 2015 03:44
21 lines
2015 bytes
> A bez serwowania z UserDir, tylko bezpośrednio pod domeną działa?

Przekopiowałem witrynę do /var/www i zmodyfikowałem .htaccess:

#v+
AuthUserFile "/var/www/application/resources/.htpass"
AuthName "Strony zabezpieczone"
AuthType Basic
require valid-user
ErrorDocument 401 "/var/www/denial.html"
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|robots\.txt|denial\.html|resources|captcha)
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]
#v-

Teraz:

[Thu Jun 25 05:28:26 2015] [error] [client 127.0.0.1] File does not exist: /var/www/var, referer: http://localhost/index.php
[Thu Jun 25 05:28:37 2015] [error] [client 127.0.0.1] File does not exist: /var/www/announcement
Re: Apache2 próbuje pobierać z /var/www zamiast ~/public_html
#408257
Author: jivanmukta
Date: Thu, 25 Jun 2015 04:41
1 lines
1462 bytes
rewrite.log jest pusty
Re: Apache2 próbuje pobierać z /var/www zamiast ~/public_html
#408258
Author: jivanmukta
Date: Thu, 25 Jun 2015 09:26
13 lines
3797 bytes
O, już nie jest pusty:

robert@pecet:~/public_html$ sudo tail /var/www/rewrite.log
127.0.0.1 - Robert [25/Jun/2015:11:10:55 +0200] [localhost/sid#b74602a0][rid#b6e2f058/initial] (1) [perdir /home/robert/public_html/] pass through /home/robert/public_html/index.php
127.0.0.1 - Robert [25/Jun/2015:11:11:05 +0200] [localhost/sid#b74602a0][rid#b6e2f058/initial] (3) [perdir /home/robert/public_html/] add path info postfix: /home/robert/public_html/announcement -> /home/robert/public_html/announcement/index
127.0.0.1 - Robert [25/Jun/2015:11:11:05 +0200] [localhost/sid#b74602a0][rid#b6e2f058/initial] (3) [perdir /home/robert/public_html/] strip per-dir prefix: /home/robert/public_html/announcement/index -> announcement/index
127.0.0.1 - Robert [25/Jun/2015:11:11:05 +0200] [localhost/sid#b74602a0][rid#b6e2f058/initial] (3) [perdir /home/robert/public_html/] applying pattern '^(.*)$' to uri 'announcement/index'
127.0.0.1 - Robert [25/Jun/2015:11:11:05 +0200] [localhost/sid#b74602a0][rid#b6e2f058/initial] (4) [perdir /home/robert/public_html/] RewriteCond: input='/home/robert/public_html/announcement' pattern='!-f' => matched
127.0.0.1 - Robert [25/Jun/2015:11:11:05 +0200] [localhost/sid#b74602a0][rid#b6e2f058/initial] (4) [perdir /home/robert/public_html/] RewriteCond: input='/home/robert/public_html/announcement' pattern='!-d' => matched
127.0.0.1 - Robert [25/Jun/2015:11:11:05 +0200] [localhost/sid#b74602a0][rid#b6e2f058/initial] (4) [perdir /home/robert/public_html/] RewriteCond: input='announcement/index' pattern='!^(index\\.php|robots\\.txt|denial\\.html|resources|captcha)' => matched
127.0.0.1 - Robert [25/Jun/2015:11:11:05 +0200] [localhost/sid#b74602a0][rid#b6e2f058/initial] (2) [perdir /home/robert/public_html/] rewrite 'announcement/index' -> '/index.php/announcement/index'
127.0.0.1 - Robert [25/Jun/2015:11:11:05 +0200] [localhost/sid#b74602a0][rid#b6e2f058/initial] (2) [perdir /home/robert/public_html/] trying to replace prefix /home/robert/public_html/ with /
127.0.0.1 - Robert [25/Jun/2015:11:11:05 +0200] [localhost/sid#b74602a0][rid#b6e2f058/initial] (1) [perdir /home/robert/public_html/] internal redirect with /index.php/announcement/index [INTERNAL REDIRECT]
Re: Apache2 próbuje pobierać z /var/www zamiast ~/public_html
#408259
Author: jivanmukta
Date: Thu, 25 Jun 2015 12:56
8 lines
2279 bytes
W /etc/apache2/error.log mam:

[Thu Jun 25 12:01:12 2015] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.18 with Suhosin-Patch configured -- resuming normal operations
[Thu Jun 25 12:40:38 2015] [notice] caught SIGTERM, shutting down
[Thu Jun 25 14:51:02 2015] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.18 with Suhosin-Patch configured -- resuming normal operations
[Thu Jun 25 14:52:55 2015] [error] [client 127.0.0.1] File does not exist: /var/www/home, referer: http://localhost/index.php/announcement/index
[Thu Jun 25 14:52:57 2015] [error] [client 127.0.0.1] File does not exist: /home/robert/public_html/captcha/1435236775.2758.jpg, referer: http://localhost/index.php/announcement/index
[Thu Jun 25 14:53:03 2015] [error] [client 127.0.0.1] File does not exist: /var/www/announcement
Re: Apache2 próbuje pobierać z /var/www zamiast ~/public_html
#408260
Author: jivanmukta
Date: Fri, 26 Jun 2015 09:04
1 lines
1648 bytes
Na serwerze hostingowym działa OK, problem jest z localhostem. Chyba mam coś nie tak Apachem...
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads