forked from TamLem/Webserv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
www.conf
75 lines (63 loc) · 3.08 KB
/
www.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# key value pairs/triples have to be contained within the same line and have to be seperated by nothing else than one whitespace character, either ' ' or '\t'
server {#server 1
listen 8000; this will configure the ports the server will be accessable from, there can be multiple ones
listen 8001; #all trailing and leading whitespaces as well as comments will be ignored
listen 8002; everything behind ; and # will be seen as comment
root /server/data/ # in between a key and its value can only be one whitespace, either ' ' or '\t'
server_name weebserv # here you can set the hostname of the server, it has to be unique
# special to this hostname will be that you are not really able to set it to anything you like as long as you are running it in 42 school,
# because for that to work you would need write access to the /etc/hosts file
# autoindex true # autoindex is treated like a boolean
autoindex false
index_page index.html # this can be any file you which, it just has to be accessable
client_body_buffer_size 104655454
client_max_body_size 1000000000 # send 413 if content length is larger than this
cgi .file_extension handler_exe #here you can set a certain file extension to be handeled as cgi as well as the cgi-executable that should be called
cgi .php ./server/data/cgi-bin/php-cgi # you need to supply the full path for the cgi executable though
cgi_bin /server/data/cgi-bin/ # this will be the folder where you put the cgi-executables
location /cgi/ {#location 1 ; in this case the use can request /cgi/ and we will show him /server/data/cgi-bin/
root /server/data/cgi-bin/
method DELETE POST GET # methods can either be set all in one line
# method GET # or individually
# method POST
# method DELETE
# Method GET // Method is not reacognized because of the capital M
index_page index.cgi
}#location 1
location /images/large_ones/ {#location 2 ; a location block can either be used with a directorypath, starting and ending with a /
root /server/data/secret/images/ # has to look exactly like this, no leading /, but always trailing /
method # this will disable all methods for this directory, which will make the diracotry unusable for the client
index_page img_index.html # this is overwriting the serverwide set index_page for this directory
# autoindex true
# autoindex false
}#location 2
error_page 404 /server/data/pages/404.html # you are also able to setup custom error pages as you like
# error_page 405 /server/data/pages/405.html
location *.ico {#location 3 ; or a location-block can be set a for a certain file-type
root /server/data/images/
method GET
autoindex true
}#location 3
}#server 1
server {#server 2
listen 8000
listen 8001
listen 8003
root /server/data/
server_name anotherone
autoindex true
error_page 405 /server/data/pages/something_else
# index_page pages/index.html
# cgi .file_extension handler_exe
# cgi .php .py
cgi_bin /cgi-bin/
# location *.php {
# root /server/data/cgi-bin
# }
# location *.jpeg {
# root /server/data/images/
# }
# location *.ico {
# root /server/data/images/
# }#
}#server 2