Temat: serwer www + php nie działa

Witam mam problem z uruchomieniem serwera lighttpd + php, wszystko zrobiłem według tego opisu http://eko.one.pl/?p=openwrt-php zmieniłem port na 81 utworzyłem folder www1 w nim plik index.php po wpisaniu 192.168.1.2/index.php przeglądarka wywala mnie na 192.168.1.2

2

Odp: serwer www + php nie działa

192.168.1.2:81/index.php

Bo taki port zrobiłeś, prawda?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3

Odp: serwer www + php nie działa

wpisuje tak i nic

4

Odp: serwer www + php nie działa

Od początku: jaki port? I czy w ogóle to uruchomiłes?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5

Odp: serwer www + php nie działa

root@Gargoyle:~# /etc/init.d/lighttpd restart
2014-07-13 14:43:23: (configfile.c.1248) base-docroot doesn't exist: /mnt/usbdrive/www1/
2014-07-13 14:43:23: (server.c.627) setting default values failed
root@Gargoyle:~#

6

Odp: serwer www + php nie działa

# lighttpd configuration file
# 
## modules to load
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
#server.modules = ( 
#    "mod_rewrite", 
#    "mod_redirect", 
#    "mod_alias", 
#    "mod_auth", 
#    "mod_status", 
#    "mod_setenv",
#    "mod_fastcgi",
#    "mod_proxy",
#    "mod_simple_vhost",
#    "mod_cgi",
#    "mod_ssi",
#    "mod_usertrack",
#    "mod_expire",
#    "mod_webdav"
#)

# force use of the "write" backend (closes: #2401)
server.network-backend = "write"

## a static document-root, for virtual-hosting take look at the 
## server.virtual-* options
server.document-root = "/www1/"

## where to send error-messages to
#server.errorlog = "/var/log/lighttpd/error.log"

## files to check for if .../ is requested
index-file.names = ( "index.html", "default.html", "index.htm", "default.htm", "index.php" )

## mimetype mapping
mimetype.assign = (  
    ".pdf"   => "application/pdf",
    ".class" => "application/octet-stream",
    ".pac"   => "application/x-ns-proxy-autoconfig",
    ".swf"   => "application/x-shockwave-flash",
    ".wav"   => "audio/x-wav",
    ".gif"   => "image/gif",
    ".jpg"   => "image/jpeg",
    ".jpeg"  => "image/jpeg",
    ".png"   => "image/png",
    ".svg"   => "image/svg+xml",
    ".css"   => "text/css",
    ".html"  => "text/html",
    ".htm"   => "text/html",
    ".js"    => "text/javascript",
    ".txt"   => "text/plain",
    ".dtd"   => "text/xml",
    ".xml"   => "text/xml"
       ".php"   => "text/php",

)

## Use the "Content-Type" extended attribute to obtain mime type if possible
#mimetypes.use-xattr = "enable"

## send a different Server: header
## be nice and keep it at lighttpd
#server.tag = "lighttpd"

$HTTP["url"] =~ "\.pdf$" {
    server.range-requests = "disable"
}

##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

######### Options that are good to be but not neccesary to be changed #######

## bind to port (default: 81)
server.port = 81

## bind to localhost (default: all interfaces)
#server.bind = "localhost"

## error-handler for status 404
#server.error-handler-404 = "/error-handler.html"
#server.error-handler-404 = "/error-handler.php"

## to help the rc.scripts
server.pid-file = "/var/run/lighttpd.pid"


###### virtual hosts
##
##   If you want name-based virtual hosting add the next three settings and load
##   mod_simple_vhost
##
## document-root =
##   virtual-server-root + virtual-server-default-host + virtual-server-docroot or
##   virtual-server-root + http-host + virtual-server-docroot
##
#simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
#simple-vhost.default-host = "grisu.home.kneschke.de"
#simple-vhost.document-root = "/pages/"


## 
## Format: <errorfile-prefix><status>.html
## -> ..../status-404.html for 'File not found'
#server.errorfile-prefix = "/www/error-"

## virtual directory listings
#server.dir-listing = "enable"

## send unhandled HTTP-header headers to error-log
#debug.dump-unknown-headers = "enable"

### only root can use these options
#
# chroot() to directory (default: no chroot() )
#server.chroot = "/"

## change uid to <uid> (default: don't care)
#server.username = "nobody"
#
server.upload-dirs = ( "/tmp" )

## change uid to <uid> (default: don't care)
#server.groupname = "nobody"

#### compress module
#compress.cache-dir          = "/dev/null/"
#compress.filetype           = ("text/plain", "text/html")

#### proxy module
## read proxy.txt for more info
#proxy.server = (
#    ".php" => (
#        "localhost" => (
#            "host" => "192.168.0.101",
#            "port" => 81
#        )
#    )
#)

#### fastcgi module
## read fastcgi.txt for more info
#fastcgi.server = (
#    ".php" => (
#        "localhost" => (
#            "socket" => "/tmp/php-fastcgi.socket",
#            "bin-path" => "/usr/local/bin/php"
#        )
#    )
#)

#### CGI module
#cgi.assign = ( ".pl"  => "/usr/bin/perl", ".cgi" => "/usr/bin/perl", ".php" => "/usr/bin/php-cgi" )

#### SSL engine
#ssl.engine = "enable"
#ssl.pemfile = "server.pem"

#### status module
#status.status-url = "/server-status"
#status.config-url = "/server-config"

#### auth module
## read authentification.txt for more info
#auth.backend = "plain"
#auth.backend.plain.userfile = "lighttpd.user"
#auth.backend.plain.groupfile = "lighttpd.group"
#auth.require = (
#    "/server-status" => ( 
#        "method"  => "digest",
#        "realm"   => "download archiv",
#        "require" => "group=www|user=jan|host=192.168.2.10"
#    ),
#    "/server-info" => ( 
#        "method"  => "digest",
#        "realm"   => "download archiv",
#        "require" => "group=www|user=jan|host=192.168.2.10"
#    )
#)

#### url handling modules (rewrite, redirect, access)
#url.rewrite = ( "^/$" => "/server-status" )
#url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )

#### both rewrite/redirect support back reference to regex conditional using %n
#$HTTP["host"] =~ "^www\.(.*)" {
#    url.redirect = ( "^/(.*)" => "http://%1/$1" )
#}

#### expire module
#expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")

#### ssi
#ssi.extension = ( ".shtml" )

#### setenv
#setenv.add-request-header  = ( "TRAV_ENV" => "mysql://user@host/db" )
#setenv.add-response-header = ( "X-Secret-Message" => "42" )

#### variable usage:
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
#bar = 1
#var.mystring = "foo"

## integer add
#bar += 1
## string concat, with integer cast as string, result: "www.foo1.com"
#server.name = "www." + mystring + var.bar + ".com"
## array merge
#index-file.names = (foo + ".php") + index-file.names
#index-file.names += (foo + ".php")

#### include
#include /etc/lighttpd/lighttpd-inc.conf
## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
#include "lighttpd-inc.conf"

#### include_shell
#include_shell "echo var.a=1"
## the above is same as:
#var.a=1

#### webdav
#$HTTP["url"] =~ "^/webdav($|/)" {
# webdav.activate = "enable"
# webdav.is-readonly = "enable"
# webdav.sqlite-db-name = "/var/run/lighttpd-webdav-lock.db"
#}

7

Odp: serwer www + php nie działa

Wypisał Ci dlaczego: nie masz katalogu /mnt/usbdrive/www1/ który podałeś jako katalog. I wcale nie jest to konfig który pokazałeś...

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

8

Odp: serwer www + php nie działa

to mój konfig skopiowałem go z etc/lighttpd

9

Odp: serwer www + php nie działa

Więc czemu drze się o /mnt/usbdrive/www1/?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

10

Odp: serwer www + php nie działa

no właśnie czemu ? jest ustawione server.document-root = "/www1/"

11

Odp: serwer www + php nie działa

/etc/init.d/lighttpd restart zrób jeszcze raz i pokaż co wyszło.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

12

Odp: serwer www + php nie działa

root@Gargoyle:~# /etc/init.d/lighttpd restart
2014-07-13 15:29:14: (configfile.c.943) source: /etc/lighttpd/lighttpd.conf line: 56 pos: 17 parser failed somehow near here: .php

13

Odp: serwer www + php nie działa

Widać że zmieniasz coś. Teraz masz po prostu błąd w konfiguracji.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

14

Odp: serwer www + php nie działa

nic nie zmieniałem

15

Odp: serwer www + php nie działa

Jakoś poprzednio tego nie wyświetlił smile. Popraw konfigurację. A dokładnie to przecina ci brakuje przed deklaracją php.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

16

Odp: serwer www + php nie działa

nie mogę znaleźć gdzie index-file.names = oto chodzi ?

17

Odp: serwer www + php nie działa

Przed linią 56, w 55 na końcu nie masz przecinka.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

18

Odp: serwer www + php nie działa

mam tak

 ".txt"   => "text/plain",
    ".dtd"   => "text/xml",
    ".xml"   => "text/xml"
    ".php"   => "text/php",

19

Odp: serwer www + php nie działa

Po raz trzeci napiszę: postaw ten przecienek. Naprawdę nie widzisz że go nie masz?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

20

Odp: serwer www + php nie działa

faktycznie , zrobiłem /etc/init.d/lighttpd restart
2014-07-13 16:27:51: (log.c.166) server started
po wpisaniu w przeglądarke http://192.168.1.2:81/index.php mam 403 - Forbidden

21

Odp: serwer www + php nie działa

Patrz w logi, zobacz czy katalog i plik ma dostatecznie uprawnienia żeby serwer je odczytał.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

22

Odp: serwer www + php nie działa

czy tego loga znajde w /var/log/lighttpd/ bo jeśli tak to nic tam nie ma pusty folder

23

Odp: serwer www + php nie działa

A włączyłeś go w konfigu?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

24

Odp: serwer www + php nie działa

nie, a jak to zrobić ?

25

Odp: serwer www + php nie działa

server.errorlog = "/var/log/lighttpd/error.log"

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.