add example

This commit is contained in:
lhw2002426 2024-04-15 16:08:24 +08:00
parent e67e370285
commit dad399aed0
3 changed files with 41 additions and 14 deletions

View File

@ -19,19 +19,6 @@ To run nginx on RuxOS, you should download this repo to its apps directory
git clone https://github.com/syswonder/rux-nginx.git ./apps/c/nginx
```
### download web page
You should make sure there is a html folder in apps/c/nginx which contains the web page of nginx server.
If you not use your own web page , you can run commands below:
```shell
git clone https://github.com/syswonder/syswonder-web.git
mkdir -p apps/c/nginx/html
cp -r syswonder-web/docs/* apps/c/nginx/html
rm -f -r syswonder-web
```
### run nginx
The commands below is to run nginx with different features. These examples run in aarch64 with musl, if you want to run in x86_64, just replace `ARCH=aarch64` with `ARCH=x86_64`, and if you do not want to run with musl , just delete `MUSL=y`.
@ -54,7 +41,16 @@ If you change running option or source code , remember to clean the compile file
make clean_c A=apps/c/nginx
```
### run example
You can just use command next to run our example
```bash
bash ./apps/c/nginx/example_run.sh
```
## ruxgo
If you want to use [ruxgo](https://github.com/syswonder/ruxgo.git) to run nginx, remember to run `apps/c/nginx/create_nginx_img.sh` first to make sure disk.img is right, or you can build your own disk.img
You can copy `ruxgo/apps/nginx/ruxos/config_linux.toml` to nginx directory and run ruxgo
@ -78,4 +74,4 @@ You can change next files to change nginx conf:
`/nginx/conf/mime.types`
After change you should copy them to disk.img (you can run `apps/c/nginx/create_nginx_img.sh` to do that)
After change you should copy them to disk.img (you can run `apps/c/nginx/create_nginx_img.sh` to do that)

8
example_run.sh Normal file
View File

@ -0,0 +1,8 @@
rm -f disk.img
git clone https://github.com/syswonder/syswonder-web.git
mkdir -p apps/c/nginx/html
cp -r syswonder-web/docs/* apps/c/nginx/html
rm -f -r syswonder-web
make A=apps/c/nginx/ LOG=info NET=y BLK=y ARCH=aarch64 SMP=4 MUSL=y run

23
html/index.html Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>