diff --git a/src/chap02/apps/nginx.md b/src/chap02/apps/nginx.md index 2bcbbe3..aac0777 100644 --- a/src/chap02/apps/nginx.md +++ b/src/chap02/apps/nginx.md @@ -12,6 +12,14 @@ git clone https://github.com/syswonder/rux-nginx.git ./apps/c/nginx 该命令将拉取Nginx的编译配置文件等文件放到 `apps/c/nginx` 目录下。 +## 运行样例 + +如果您只是想要测试nginx的可运行性,而不关心nginx本身运行的内容,可以通过下面的命令直接运行样例 + +``` +bash ./apps/c/nginx/example_run.sh +``` + ## 创建文件系统镜像 运行时,需要保证文件系统中存在以下文件: @@ -30,14 +38,7 @@ git clone https://github.com/syswonder/rux-nginx.git ./apps/c/nginx ## 创建网页文件 -在默认设置下运行时,`apps/c/nginx` 目录下需要有一个名为 html 的文件夹,用来装载 Nginx 服务器的网页。如果您不想使用自己的网页,可以运行如下的命令来添加 html 的文件: - -```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 -``` +在默认设置下运行时,`apps/c/nginx` 目录下需要有一个名为 html 的文件夹,用来装载 Nginx 服务器的网页。 网页文件也可以设置在其他路径上,详见下面关于 nginx.conf 以及 9p 的内容 @@ -92,6 +93,17 @@ make A=apps/c/nginx/ LOG=info NET=y BLK=y FEATURES=virtio-9p V9P=y V9P_PATH=./ap * `FEATURES=virtio-9p`:告诉 RuxOS 启用 9p 功能 * `V9P_PATH`: `V9P_PATH` 指向 host 上的用于共享的目录,默认情况下这是网页文件的位置。 +## 使用HTTPS + +默认情况下,nginx用作http网络服务器,如果您想要使用https,请使用rux-nginx的with_ssl分支 + +``` +rm -rf ./apps/c/nginx +git clone https://github.com/syswonder/rux-nginx.git -b with_ssl ./apps/c/nginx +``` + +其他运行步骤不变 + ## nginx.conf 您可以修改`apps/c/nginx`目录下的 nginx.conf 文件来对 Nginx 的配置进行修改,包括修改 Nginx 服务器功能、修改服务器参数、修改 Nginx 运行选项等。 diff --git a/translations/en/chap02/apps/nginx.md b/translations/en/chap02/apps/nginx.md index d3711a4..562275b 100644 --- a/translations/en/chap02/apps/nginx.md +++ b/translations/en/chap02/apps/nginx.md @@ -12,6 +12,15 @@ git clone https://github.com/syswonder/rux-nginx.git ./apps/c/nginx This command will clone the makefile and config files related to Nginx into the `apps/c/nginx` directory. +## Running Example + +If you just want to test the runnability of nginx and are not concerned about the content it runs, you can directly execute the following command to run the example: + +``` +bashCopy code +bash ./apps/c/nginx/example_run.sh +``` + ## Creating a File System Image When running, it is necessary to ensure the following files exist in the file system: @@ -28,18 +37,11 @@ If there is no disk.img in the root directory of RuxOS, an appropriate img will If you want to regenerate the image, you can run the create_nginx_img.sh script in the apps/c/nginx directory. -## Creating Web Page Files - -By default, when running, the `apps/c/nginx` directory needs to have a folder named html to load the web pages of the Nginx server. If you do not want to use your own web pages, you can run the following command to add files to the html folder: +## Creating Webpage Files -```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 -``` +When running with default settings, a folder named `html` must be present in the `apps/c/nginx` directory to load the web pages for the Nginx server. -Web page files can also be set in other paths, see below for details about nginx.conf and 9p. +The webpage files can also be set in other paths, see the details below regarding `nginx.conf` and `Using 9pfs`. ## Running Nginx @@ -91,6 +93,17 @@ Parameter explanation: `FEATURES=virtio-9p`: Tells RuxOS to enable the 9p feature. `V9P_PATH`: V9P_PATH points to the directory on the host that is shared, by default this is the location of the web page files. +## Using HTTPS + +By default, nginx is used as an HTTP web server. If you want to use HTTPS, please use the `with_ssl` branch of rux-nginx: + +``` +bashCopy coderm -rf ./apps/c/nginx +git clone https://github.com/syswonder/rux-nginx.git -b with_ssl ./apps/c/nginx +``` + +Other running steps remain unchanged. + ## nginx.conf You can modify the nginx.conf file in the apps/c/nginx directory to change the configuration of Nginx, including changing server functions, modifying server parameters, changing Nginx operation options, etc.