Skip to content

Commit

Permalink
sync with vog
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugothms committed Jan 21, 2022
1 parent 9548e2d commit b5bd637
Show file tree
Hide file tree
Showing 34 changed files with 455 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ test
*.DS_Store
www/tmp/*
webserv_correc.pdf
cgis/*
15 changes: 5 additions & 10 deletions config/base.conf
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
server {
listen 4343
server_name localhost test.com
root www
index index.html
error_page 404 /404.html
error_page 405 /405.html
max_client_body_size 400
listen 4343;
root www/site0;
index index.html;
location / {
allow GET POST DELETE
index index.html
allow GET;
}
}
}
60 changes: 31 additions & 29 deletions config/locations.conf
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
server {
listen 4343;
server_name localhost test.com;
root www/;
cgi .py /usr/bin/python2.7;
cgi .php ./www/cgi-bin/php-cgi;
cgi .php ./cgis/php-cgi;
root www;
index index.html;
error_page 405 /405.html;
max_client_body_size 4096;

max_client_body_size 10;
location / {
allow GET HEAD POST DELETE;
# index page.html;
allow GET POST DELETE;
root first;
index page.html;
}
location /first/ {
allow GET HEAD;
location /one/ {
allow GET DELETE POST;
autoindex 1;
# index page.html;
}
location /demo/ {
allow GET HEAD POST DELETE;
index index.html;
root /site1;
}
# location /first/second/ {
# allow GET;
# # index page.html;
# }
location /blabla/ {
location /two {
allow GET;
# index page.html;
root site2/;
index hello.html;
}
location /first_redirect/ {
location /three {
allow GET POST DELETE;
root site3/;
index index.html;
}
}

server {
listen 6969;
server_name localhost data.com;
root www;
index index.html;
max_client_body_size 10;
location / {
allow GET;
root first/;
index page.html;
autoindex 1;
}
location /form/ {
allow GET POST;
return 301 http://localhost/form.html;
# index page.html;
location /data/ {
allow GET DELETE;
autoindex 1;
root uploads;
}
}
32 changes: 32 additions & 0 deletions config/servers.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
server {
listen 4344;
server_name foo;
root www/first;
index page.html;
cgi .php ./cgis/php-cgi;
location / {
allow GET;
}
}

server {
listen 4343;
server_name foo;
root www/site1;
index index.html;
cgi .php ./cgis/php-cgi;
location / {
allow GET;
}
}

server {
listen 4343;
server_name bar;
root www/site2;
index index.html;
cgi .php ./cgis/php-cgi;
location / {
allow GET;
}
}
28 changes: 28 additions & 0 deletions config/tricks.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
server {
listen 6969;
cgi .php /usr/bin/php-cgi;
cgi .py /usr/bin/python;
root www;
index index.html;
max_client_body_size -1;
location / {
allow GET;
autoindex 0;
index trick.html;
}
location /php {
allow GET POST;
autoindex 1;
root /site1;
}
location /py {
allow GET POST;
autoindex 1;
root /site2;
}
location /downloads {
allow GET DELETE;
autoindex 1;
root /uploads;
}
}
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions www/UNUSED/hello.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
body {
/*margin: 25px;*/
background-color: orange;
color: red;
border: 200px;
/*font-family: arial, sans-serif;*/
/*font-size: 14px;*/
}
div {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
}
/* Applies to all <h1>...</h1> elements. */
/* h1 {
font-size: 35px;
font-weight: bold;
margin-top: 5px;
} */

img {
max-width: 100%;
height: auto;
}

/* Applies to all elements with <... class="someclass"> specified. */
/*.someclass { color: red; }*/

/* Applies to the element with <... id="someid"> specified. */
/*#someid { color: green; }*/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 43 additions & 0 deletions www/UNUSED/simple_form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<html lang="en">
<body style="background-color: darkslateblue; color: lightgrey;">
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;">
<h1>form.html</h1>


<?php

if(isset($_GET["s1"]) || isset($_GET["s2"]))
{
echo "Using the GET method to pass data<br/>";
echo "s1 is ".$_GET["s1"].".<br/>";
echo "s2 is ".$_GET["s2"].".<br/>";
}
else if(isset($_POST["s1"]) || isset($_POST["s2"]))
{
echo "Using the POST method to pass data<br/>";
echo "s1 is ".$_POST["s1"].".<br/>";
echo "s2 is ".$_POST["s2"].".<br/>";
}
?>

<h2>Post mode</h2>
<form action="/simple_form.php" method="post">
<p>s1: <input type="text" name="s1" /></p>
<p>s2: <input type="text" name="s2" /></p>
<p><input type="submit" /></p>
</form>

<h2>Get mode</h2>
<form action="/simple_form.php" method="get">
<p>s1: <input type="text" name="s1" /></p>
<p>s2: <input type="text" name="s2" /></p>
<p><input type="submit" /></p>
</form>




</form>
</div>
</body>
</html>
File renamed without changes.
Binary file added www/site0/doge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/site0/favicon.ico
Binary file not shown.
32 changes: 32 additions & 0 deletions www/site0/hello.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
body {
/*margin: 25px;*/
background-color: orange;
color: red;
border: 200px;
/*font-family: arial, sans-serif;*/
/*font-size: 14px;*/
}
div {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
}
/* Applies to all <h1>...</h1> elements. */
/* h1 {
font-size: 35px;
font-weight: bold;
margin-top: 5px;
} */

img {
max-width: 100%;
height: auto;
}

/* Applies to all elements with <... class="someclass"> specified. */
/*.someclass { color: red; }*/

/* Applies to the element with <... id="someid"> specified. */
/*#someid { color: green; }*/
17 changes: 17 additions & 0 deletions www/site0/hello.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="hello.css">
<script src="hello.js"></script>
<meta charset="UTF-8">
</head>
<body>
<div>
<h1>hello.html</h1>
<button onclick="myFunction()">
Hello
</button>
<img src="doge.png">
</div>
</body>
</html>
4 changes: 4 additions & 0 deletions www/site0/hello.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function myFunction()
{
alert("Hello world :-)")
}
8 changes: 8 additions & 0 deletions www/site0/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html lang="en">
<body style="background-color: grey; color: lightgrey;">
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;">
<h1>Landing page</h1>
<a href="hello.html">Demo page</a>
</div>
</body>
</html>
42 changes: 42 additions & 0 deletions www/site1/form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<html lang="en">
<body style="background-color: darkslateblue; color: lightgrey;">
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;">
<h1>Passing form data to PHP-CGI</h1>


<?php

if(isset($_GET["s1"]) || isset($_GET["s2"]))
{
echo "Using the GET method to pass data<br/>";
echo "s1 is ".$_GET["s1"].".<br/>";
echo "s2 is ".$_GET["s2"].".<br/>";
}
else if(isset($_POST["s1"]) || isset($_POST["s2"]))
{
echo "Using the POST method to pass data<br/>";
echo "s1 is ".$_POST["s1"].".<br/>";
echo "s2 is ".$_POST["s2"].".<br/>";
}
?>

<h2>Post mode</h2>
<form action="/one/form.php" method="post">
<p>s1: <input type="text" name="s1" /></p>
<p>s2: <input type="text" name="s2" /></p>
<p><input type="submit" /></p>
</form>

<h2>Get mode</h2>
<form action="/one/form.php" method="get">
<p>s1: <input type="text" name="s1" /></p>
<p>s2: <input type="text" name="s2" /></p>
<p><input type="submit" /></p>
</form>




</div>
</body>
</html>
7 changes: 7 additions & 0 deletions www/site1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<html lang="en">
<body style="background-color: grey; color: lightgrey;">
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;">
<h1>index of site1 called index.html</h1>
</div>
</body>
</html>
Loading

0 comments on commit b5bd637

Please sign in to comment.