Improved the Nginx example

This commit is contained in:
Syrus 2018-12-06 20:25:14 -08:00
parent 3c730d4610
commit 78c9c73c77
7 changed files with 62 additions and 1 deletions

View File

@ -19,7 +19,7 @@ format defined by the WebAssembly reference interpreter (`.wat`).
Once installed, you will be able to run:
```sh
wasmer run nginx.wasm
wasmer run examples/nginx/nginx.wasm -- -p examples/nginx -c nginx.conf
```
## Building & Running

1
examples/nginx/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*_temp

View File

@ -0,0 +1,36 @@
<html>
<head>
<meta charset="UTF-8" />
<link
href="https://fonts.googleapis.com/css?family=Open+Sans"
rel="stylesheet"
/>
</head>
<body>
<div class="main">
<h1>
You did it! Nginx is running using
<a href="https://wasmer.io"
><img class="wasmer-logo" src="./wasmer-logo.png"
/></a>
</h1>
<p>Enjoy this incredible achievement with us! 😊</p>
</div>
</body>
<style>
body {
font-family: "Open Sans", sans-serif;
}
h1 {
font-weight: 600;
}
.main {
margin: 0 auto;
max-width: 600px;
padding: 10px;
}
.wasmer-logo {
width: 200px;
}
</style>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

24
examples/nginx/nginx.conf Normal file
View File

@ -0,0 +1,24 @@
events {
}
# We need this for now, as we want to run nginx as a worker
daemon off;
master_process off;
# We show the errors and info in stderr
error_log /dev/stderr info;
http {
# We show access in the stdout
access_log /dev/stdout;
server {
listen 8080;
server_name _;
location / {
# IMPORTANT: Replace the dir with the one you want to serve (that have an index.html file)
root ./html/;
index index.html;
}
}
}