# Newbie config not working

**URL:** <https://www.ruby-forum.com/t/newbie-config-not-working/180465>\
**Category:** NGINX\
**Created:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/newbie-config-not-working/180465 "2009-12-19T15:25:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mystique](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mystique](https://www.ruby-forum.com/u/mystique)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/newbie-config-not-working/180465/1 "2009-12-19T15:25:42Z")

</div>

hey all, nginx from freebsd ports 0.7.64 i386

Below is my config.

I am trying to move from a lighttpd server and try out nginx. Below is  
my actual config. Everything is installed from ports. and php is being  
run by spawn-fcgi

nginx.conf:

```
 1 worker_processes 2;
 2
 3 events {
 4 worker_connections 1024;
 5 use kqueue;
 6 }
 7
 8 http {
 9 include mime.types;
10 default_type application/octet-stream;
11 sendfile on;
12 keepalive_timeout 65;
13
14 access_log /var/log/nginx-access.log;
15 error_log /var/log/nginx-error.log;
16
17 tcp_nopush on;
18 tcp_nodelay on;
19 charset utf-8;
20 gzip on;
21 gzip_types text/plain application/xml text/javascript;
22 gzip_min_length 512;
23
24 server {
25 listen 80;
26 server_name _;
27 server_name_in_redirect off;
28 access_log /var/log/nginx-default.log;
29
30 location / {
31 index index.html;
32 root /usr/local/www/nginx;
33 }
34
35 }
36
37
38 server {
39 listen 80;
40 server_name domain.org www.domain.org;
41 root /usr/local/www/wordpress;
42 include php_fastcgi_support;
43 index index.php;
44
45 location / {
46 try_files $uri $uri/ /index.php?q=$uri&$args;
47 }
48
49 }
50
51 server {
52 listen 443;
53 ssl on;
54 ssl_certificate /usr/local/www/ssl/server.crt;
55 ssl_certificate_key /usr/local/www/ssl/server.key;
56
57 server_name secure.domain.org;
58
59 keepalive_timeout 65;
60
61 location / {
62 root /usr/local/www/data;
63 index index.htm;
64 }
65
66 location /wiki/ {
67 alias /usr/local/www/dokuwiki/;
68 include php_fastcgi_support;
69 index doku.php;
70 }
71
72 if (!-f $request_filename) {
73 rewrite ^(/wiki/)(.*)?(.*) $1doku.php?id=$2&$3 last;
74 rewrite ^(/wiki/)$ $1doku.php last;
75 }
76
77 }
78
79 }

```

php\_fastcgi\_support:

```
 1 location ~ \.php$ {
 2 fastcgi_pass 127.0.0.1:9000;
 3 fastcgi_index index.php;
 4 fastcgi_param SCRIPT_FILENAME 

```

$document\_root$fastcgi\_script\_name;  
5 include fastcgi\_params;  
6 }

going to [http://www.domain.org/](http://www.domain.org/) shows the wordpress site like it should  
and wp-admin and the likes all seem to work (wonderful)

The part that is not working as desired is the ssl portion.

going to [https://secure.domain.org](https://secure.domain.org) works as intended; which is rendering  
the contents of /usr/local/www/data trying to get to  
[https://secure.domain.org/wiki/(index.php)](https://secure.domain.org/wiki/(index.php)) does not work at all.

I get the generic “no input file specified”.

192.168.10.199 - - [17/Dec/2009:14:39:28 -0500] “GET /wiki/index.php  
HTTP/1.1” 404 62 “-”  
192.168.10.199 - - [17/Dec/2009:14:40:40 -0500] “GET /wiki/doku.php  
HTTP/1.1” 404 62 “-”

Can someone suggest what I might be doing wrong?

thanks in advance

Posted at Nginx Forum:

> **[Newbie config not working..](https://forum.nginx.org/read.php?2,31388,31388#msg-31388)**
>
> hey all, nginx from freebsd ports 0.7.64 i386 Below is my config. I am trying to move from a lighttpd server and try out nginx. Below is my actual config. Everything is installed from ports. and php is being run by spawn-fcgi nginx.conf: \[code\]

---

<div class="post-metadata">

**Author:** ![mystique](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mystique](https://www.ruby-forum.com/u/mystique)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/newbie-config-not-working/180465/2 "2009-12-19T15:25:42Z")

</div>

On Thu, Dec 17, 2009 at 11:58 AM, mystique [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> 3 events {
> 
> ```
> 
> 14 access\_log /var/log/nginx-access.log;  
> 25 listen 80;  
> 36  
> 47 }  
> 58  
> 69 index doku.php;
> 
> 192.168.10.199 - - [17/Dec/2009:14:40:40 -0500] “GET /wiki/doku.php HTTP/1.1” 404 62 “-”  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

Helped on IRC; the problem was that the PHP location had a different  
root from the wiki location, so we added another PHP location specific  
to the wiki. A bit later I will be posting updated pretty-urls setup  
to the wiki.

– Merlin

---

<div class="post-metadata">

**Author:** ![mystique](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mystique](https://www.ruby-forum.com/u/mystique)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/newbie-config-not-working/180465/3 "2009-12-19T15:25:42Z")

</div>

Hello!

On Thu, Dec 17, 2009 at 02:58:41PM -0500, mystique wrote:

[…]

> ```
> 66 location /wiki/ {
> 67 alias /usr/local/www/dokuwiki/;
> 68 include php_fastcgi_support;
> 69 index doku.php;
> 70 }
> 
> ```

[…]

> going to [http://www.domain.org/](http://www.domain.org/) shows the wordpress site like it should and wp-admin and the likes all seem to work (wonderful)
> 
> The part that is not working as desired is the ssl portion.
> 
> going to [https://secure.domain.org](https://secure.domain.org) works as intended; which is rendering the contents of /usr/local/www/data trying to get to [https://secure.domain.org/wiki/(index.php)](https://secure.domain.org/wiki/(index.php)) does not work at all.

You have no root defined for location /wiki/. You use alias  
instead, but alias a) isn’t inherited into nested location you use  
to handle .php files and b) doesn’t affect $document\_root variable  
anyway. So

```
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

```

uses default root while resolving $document\_root, which isn’t likely  
what you want.

Try this instead:

```
location /wiki/ {
    alias /usr/local/www/dokuwiki/;
    index doku.php;

    location ~ ^/wiki(.*\.php)$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME /usr/local/www/dokuwiki$1;
        include fastcgi_params;

    }
}

```

Maxim D.

---

<div class="post-metadata">

**Author:** ![mystique](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mystique](https://www.ruby-forum.com/u/mystique)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/newbie-config-not-working/180465/4 "2009-12-19T15:25:42Z")

</div>

On Thu, Dec 17, 2009 at 2:22 PM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ```
> }
> 
> ```
> 
> }
> 
> Maxim D.

We worked it out into a configuration very similar but not with the  
sublocation (I considered that a mistake, though I know they work we  
just aren’t “officially” supporting them yet, right?). Below I have  
pasted the last known config.

server {  
listen 443;  
ssl on;  
ssl\_certificate /usr/local/www/ssl/server.crt;  
ssl\_certificate\_key /usr/local/www/ssl/server.key;

root /usr/local/www;  
server\_name [secure.domain.org](http://secure.domain.org);

error\_log /var/log/nginx-error.log info;

keepalive\_timeout 65;

location / {  
root /usr/local/www/data;  
index index.htm;  
}

location /wiki {  
alias /usr/local/www/dokuwiki;  
index doku.php;  
}

location ~ ^/wiki(/.\*.php)$ {  
include fastcgi\_params;  
fastcgi\_param SCRIPT\_FILENAME /usr/local/www/dokuwiki$1;  
fastcgi\_pass localphp;  
}

location ~ .php$ {  
include fastcgi.conf;  
fastcgi\_pass localphp;  
}  
}

– Merlin
