Nginx可视化配置工具NginxConfig

81次阅读
没有评论
Nginx可视化配置工具NginxConfig

通行路程40+min,一般你们都干嘛呢?作为一只单身汪,不得已只能看看微信公众号文章或刷刷B乎奇怪的知识,刚好刷到了今天的主题:可视化生成Nginx配置。奇奇怪怪的知识又增加了

NginxConfig是一个简单的可视化配置生成Web服务,配置高性能、安全、稳定的NGINX服务器的最简单方法。官方体验:https://www.digitalocean.com/community/tools/nginx?global.app.lang=zhCN,也可以自行部署,NginxConfig是一个基于Vue的前端项目

NginxConfig部署

node安装

# 下载并解压node
[root@node-nfs ~]# cd  /usr/local/src/
[root@node-nfs ~]# wget https://nodejs.org/download/release/v15.7.0/node-v15.7.0-linux-x64.tar.gz
[root@node-nfs ~]# tar -zvxf node-v15.7.0-linux-x64.tar.gz
[root@node-nfs ~]# mv node-v15.7.0-linux-x64 /usr/local/node-v15.7.0
[root@node-nfs ~]# ll /usr/local/node-v15.7.0
总用量 172
drwxr-xr-x. 2 1001 1001    40 1月  26 2021 bin
-rw-r--r--. 1 1001 1001 54620 1月  26 2021 CHANGELOG.md
drwxr-xr-x. 3 1001 1001    18 1月  26 2021 include
drwxr-xr-x. 3 1001 1001    26 1月  26 2021 lib
-rw-r--r--. 1 1001 1001 82584 1月  26 2021 LICENSE
-rw-r--r--. 1 1001 1001 30147 1月  26 2021 README.md
drwxr-xr-x. 5 1001 1001    45 1月  26 2021 share

# 配置node环境
[root@node-nfs node-v15.7.0]# cat >>/etc/profile<<'EOF'
export NODE_HOME=/usr/local/node-v15.7.0
export PATH=$PATH:$NODE_HOME/bin
EOF

# 测试检验node
[root@node-nfs node-v15.7.0]# source /etc/profile
[root@node-nfs ~]# node -v
v15.7.0

cnpm安装

# npm镜像可能会因为一些境外网络导致包安装超时,所以使用国内淘宝镜像来配置安装
[root@node-nfs ~]# npm install -g cnpm --registry=https://registry.npm.taobao.org
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 372 packages in 2m

3 packages are looking for funding
  run `npm fund` for details
npm notice 
npm notice New major version of npm available! 7.4.3 -> 8.9.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.9.0
npm notice Run npm install -g npm@8.9.0 to update!
npm notice 

# 查看cnpm
[root@node-nfs ~]# cnpm -v
npm notice 
npm notice New major version of npm available! 7.4.3 -> 8.9.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.9.0>
npm notice Run `npm install -g npm@8.9.0` to update!
npm notice 
cnpm@7.1.1 (/usr/local/node-v15.7.0/lib/node_modules/cnpm/lib/parse_argv.js)
npm@6.14.17 (/usr/local/node-v15.7.0/lib/node_modules/cnpm/node_modules/npm/lib/npm.js)
node@15.7.0 (/usr/local/node-v15.7.0/bin/node)
npminstall@5.8.1 (/usr/local/node-v15.7.0/lib/node_modules/cnpm/node_modules/npminstall/lib/index.js)
prefix=/usr/local/node-v15.7.0 
linux x64 3.10.0-957.el7.x86_64 
registry=https://registry.npmmirror.com

拉取代码安装依赖

代码仓库:https://github.com/digitalocean/nginxconfig.io.git

# git clone 代码
[root@node-nfs project]# git clone https://github.com/digitalocean/nginxconfig.io.git
正克隆到 'nginxconfig.io'...
remote: Enumerating objects: 5923, done.
remote: Counting objects: 100% (1251/1251), done.
remote: Compressing objects: 100% (269/269), done.
remote: Total 5923 (delta 1100), reused 1074 (delta 980), pack-reused 4672
接收对象中: 100% (5923/5923), 6.49 MiB | 2.33 MiB/s, done.
处理 delta 中: 100% (3721/3721), done.

cnpm安装依赖

# 编译
[root@node-nfs project]# cd nginxconfig.io
[root@node-nfs nginxconfig.io]# cnpm install
⠋ [do-bulma@github:do-community/do-bulma] install do-bulma from git do-bulma@github:do-community/do-bulma, may be very slow, please keep patience
[do-vue@github:do-community/do-vue] install do-vue from git do-vue@github:do-community/do-vue, may be very slow, please keep patience
⠏ [4/41] Installing semver@^6.3.0
WARN node unsupported "node@v15.7.0" is incompatible with chalk@^5.0.0, expected node@^12.17.0 || ^14.13 || >=16.0.0
⠙ [4/41] Installing eslint@^8.9.0
WARN node unsupported "node@v15.7.0" is incompatible with node-fetch@^3.2.0, expected node@^12.20.0 || ^14.13.1 || >=16.0.0
⠧ [7/41] Installing @babel/types@^7.16.7[@babel/traverse@7.17.10] use @babel/traverse@7.17.9 instead, reason: https://github.com/babel/babel/issues/14525
⠸ [9/41] Installing collect-v8-coverage@^1.0.0[@babel/traverse@7.17.10] use @babel/traverse@7.17.9 instead, reason: https://github.com/babel/babel/issues/14525
⠇ [9/41] Installing pretty-format@^27.5.1[@babel/traverse@7.17.10] use @babel/traverse@7.17.9 instead, reason: https://github.com/babel/babel/issues/14525
⠸ [11/41] Installing ms@2.1.2[@babel/traverse@7.17.10] use @babel/traverse@7.17.9 instead, reason: https://github.com/babel/babel/issues/14525
⠏ [16/41] Installing fill-range@^7.0.1
WARN node unsupported "node@v15.7.0" is incompatible with @vue/cli-service@5.0.4 › @vue/cli-shared-utils@5.0.4 › @achrinza/node-ipc@9.2.2, expected node@8 || 10 || 12 || 14 || 16 || 17
⠦ [18/41] Installing any-promise@^1.0.0[@babel/traverse@7.17.10] use @babel/traverse@7.17.9 instead, reason: https://github.com/babel/babel/issues/14525
⠙ [18/41] Installing supports-preserve-symlinks-flag@^1.0.0
WARN node unsupported "node@v15.7.0" is incompatible with eslint-plugin-vue@^8.4.1, expected node@^12.22.0 || ^14.17.0 || >=16.0.0
⠹ [21/41] Installing sprintf-js@~1.0.2
WARN node unsupported "node@v15.7.0" is incompatible with eslint-plugin-vue@8.7.1 › vue-eslint-parser@^8.0.1, expected node@^12.22.0 || ^14.17.0 || >=16.0.0
⠴ [21/41] Installing webidl-conversions@^4.0.2
WARN node unsupported "node@v15.7.0" is incompatible with eslint-plugin-vue@8.7.1 › vue-eslint-parser@8.3.0 › eslint-visitor-keys@^3.1.0, expected node@^12.22.0 || ^14.17.0 || >=16.0.0
⠦ [21/41] Installing domelementtype@^2.2.0
WARN node unsupported "node@v15.7.0" is incompatible with eslint-plugin-vue@8.7.1 › vue-eslint-parser@8.3.0 › espree@^9.0.0, expected node@^12.22.0 || ^14.17.0 || >=16.0.0
⠧ [22/41] Installing eslint-visitor-keys@^3.3.0
WARN node unsupported "node@v15.7.0" is incompatible with eslint-plugin-vue@8.7.1 › vue-eslint-parser@8.3.0 › eslint-scope@^7.0.0, expected node@^12.22.0 || ^14.17.0 || >=16.0.0
⠙ [22/41] Installing estraverse@^5.1.0
WARN node unsupported "node@v15.7.0" is incompatible with stylelint@^14.5.1, expected node@^12.20.0 || ^14.13.1 || >=16.0.0
⠼ [24/41] Installing regenerate@^1.4.2
WARN node unsupported "node@v15.7.0" is incompatible with eslint@^8.9.0, expected node@^12.22.0 || ^14.17.0 || >=16.0.0

WARN node unsupported "node@v15.7.0" is incompatible with stylelint@14.8.2 › write-file-atomic@^4.0.1, expected node@^12.13.0 || ^14.15.0 || >=16
⠹ [26/41] Installing lru-cache@^6.0.0
WARN node unsupported "node@v15.7.0" is incompatible with eslint@8.15.0 › @eslint/eslintrc@^1.2.3, expected node@^12.22.0 || ^14.17.0 || >=16.0.0
⠏ [35/41] Installing @xtuc/long@4.2.2[do-vue@1.0.0 › browserify-fs@git+https://github.com/do-community/browserify-fs.git] install browserify-fs from git browserify-fs@git+https://github.com/do-community/browserify-fs.git, may be very slow, please keep patience
✔ Installed 41 packages
✔ Linked 1089 latest versions
[1/1] scripts.postinstall core-js@^3.21.1 run "node -e \"try{require('./postinstall')}catch(e){}\"", root: "/root/project/nginxconfig.io/node_modules/_core-js@3.22.4@core-js"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js:
> https://opencollective.com/core-js 
> https://patreon.com/zloirock 
> bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

[1/1] scripts.postinstall core-js@^3.21.1 finished in 55ms
✔ Run 1 scripts
peerDependencies link ajv@6.12.6 in /root/project/nginxconfig.io/node_modules/_ajv-keywords@3.5.2@ajv-keywords unmet with /root/project/nginxconfig.io/node_modules/ajv(8.11.0)
peerDependencies WARNING jest@^27.5.1 requires a peer of node-notifier@^8.0.1 || ^9.0.0 || ^10.0.0 but none was installed
peerDependencies WARNING sass-loader@^12.6.0 requires a peer of fibers@>= 3.1.0 but none was installed
peerDependencies WARNING pretty-checkbox-vue@^1.1.9 requires a peer of vue@^2.2.0 but vue@3.2.33 was installed
peerDependencies WARNING jest@27.5.1 › jest-cli@^27.5.1 requires a peer of node-notifier@^8.0.1 || ^9.0.0 || ^10.0.0 but none was installed
peerDependencies WARNING jest@27.5.1 › @jest/core@^27.5.1 requires a peer of node-notifier@^8.0.1 || ^9.0.0 || ^10.0.0 but none was installed
peerDependencies WARNING jest@27.5.1 › jest-cli@27.5.1 › jest-config@^27.5.1 requires a peer of ts-node@>=9.0.0 but none was installed
peerDependencies WARNING webpack-bundle-analyzer@4.5.0 › ws@^7.3.1 requires a peer of bufferutil@^4.0.1 but none was installed
peerDependencies WARNING @vue/cli-service@5.0.4 › webpack-dev-server@4.9.0 › ws@^8.4.2 requires a peer of bufferutil@^4.0.1 but none was installed
peerDependencies WARNING jest@27.5.1 › jest-cli@27.5.1 › jest-config@27.5.1 › jest-environment-jsdom@27.5.1 › jsdom@^16.6.0 requires a peer of canvas@^2.5.0 but none was installed
peerDependencies WARNING do-vue@1.0.0 › jsdom@^19.0.0 requires a peer of canvas@^2.5.0 but none was installed
peerDependencies WARNING @vue/cli-service@5.0.4 › @vue/cli-shared-utils@5.0.4 › node-fetch@^2.6.7 requires a peer of encoding@^0.1.0 but none was installed
peerDependencies WARNING jest@27.5.1 › @jest/core@27.5.1 › @jest/reporters@^27.5.1 requires a peer of node-notifier@^8.0.1 || ^9.0.0 || ^10.0.0 but none was installed
peerDependencies WARNING sass-loader@^12.6.0 requires a peer of node-sass@^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 but none was installed
peerDependencies WARNING webpack-bundle-analyzer@4.5.0 › ws@^7.3.1 requires a peer of utf-8-validate@^5.0.2 but none was installed
peerDependencies WARNING @vue/cli-service@5.0.4 › webpack-dev-server@4.9.0 › ws@^8.4.2 requires a peer of utf-8-validate@^5.0.2 but none was installed
peerDependencies WARNING sass-loader@^12.6.0 requires a peer of sass-embedded@* but none was installed
deprecate do-vue@1.0.0 › request@^2.88.2 request has been deprecated, see https://github.com/request/request/issues/3142
deprecate do-vue@1.0.0 › request@2.88.2 › har-validator@~5.1.3 this library is no longer supported
deprecate do-vue@1.0.0 › request@2.88.2 › uuid@^3.3.2 Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
deprecate do-vue@1.0.0 › react-svg-loader@3.0.3 › react-svg-core@3.0.3 › svgo@^1.2.2 This SVGO version is no longer supported. Upgrade to v2.x.x.
deprecate do-vue@1.0.0 › browserify-fs@1.0.0 › level-filesystem@1.2.0 › level-sublevel@5.2.3 › xtend@2.0.6 › object-keys@~0.2.0 Please update to the latest object-keys
✔ All packages installed (1253 packages installed from npm registry, 3 packages installed from git, used 28s(network 27s), speed 0B/s, json 0(0B), tarball 0B, manifests cache hit 1087, etag hit 0 / miss 0)

运行

方式一:使用cnpm运行

[root@node-nfs nginxconfig.io]# cnpm run dev

> nginxconfig.io@1.0.0 dev /root/project/nginxconfig.io
> npm run build:template && npm run build:prism && npm run dev:tool


> nginxconfig.io@1.0.0 build:template
> do-vue template && node src/nginxconfig/build/template.js

Fetching Community Tools template from www.digitalocean.com...
...fetching & conversion completed, saved to build/base.html

> nginxconfig.io@1.0.0 build:prism
> node src/nginxconfig/build/prism.js


> nginxconfig.io@1.0.0 dev:tool
> vue-cli-service serve src/nginxconfig/mount.js

 INFO  Starting development server...
[95%] emitting (emit)
(node:9333) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API



 WARNING  Compiled with 1 warning                                                                                                                              下午2:25:06

 warning  in ./src/nginxconfig/scss/style.scss

Module Warning (from ./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js):
Warning

(12674:5) autoprefixer: Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated.

Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/chunk-vendors.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/app.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_ru_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_pt-br_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_es_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_fr_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_de_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_pl_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_zh-cn_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_zh-tw_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_templates_prism_yaml_vue.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_templates_prism_docker_vue.js": no such file

No bundles were parsed. Analyzer will show only original module sizes from stats file.

Webpack Bundle Analyzer saved report to /root/project/nginxconfig.io/dist/report.html

  App running at:
  - Local:   http://localhost:8080 
  - Network: http://192.168.174.135:8080

  Note that the development build is not optimized.
  To create a production build, run npm run build.




 WAIT  Compiling...                                                                                                                                            下午2:25:07

Compiling...



 WARNING  Compiled with 1 warning                                                                                                                              下午2:25:07

 warning  in ./src/nginxconfig/scss/style.scss

Module Warning (from ./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js):
Warning

(12674:5) autoprefixer: Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated.

Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/chunk-vendors.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/app.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_ru_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_pt-br_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_es_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_fr_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_de_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_pl_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_zh-cn_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_i18n_zh-tw_index_js.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_templates_prism_yaml_vue.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/js/src_nginxconfig_templates_prism_docker_vue.js": no such file
Error parsing bundle asset "/root/project/nginxconfig.io/dist/app.498542d2466fb7c1.hot-update.js": no such file

No bundles were parsed. Analyzer will show only original module sizes from stats file.

Webpack Bundle Analyzer saved report to /root/project/nginxconfig.io/dist/report.html

  App running at:
  - Local:   http://localhost:8080 
  - Network: http://192.168.174.135:8080

方式二:使用nginx运行

# 编译文件,默认编译输出到dist
[root@node-nfs nginxconfig.io]# cnpm run build

> nginxconfig.io@1.0.0 build /root/project/nginxconfig.io
> npm run build:clean && npm run build:template && npm run build:prism && npm run build:static && npm run build:tool


> nginxconfig.io@1.0.0 build:clean
> do-vue clean

Cleaning out dist directory...
...dist directory cleaned for build.

> nginxconfig.io@1.0.0 build:template
> do-vue template && node src/nginxconfig/build/template.js

Fetching Community Tools template from www.digitalocean.com...
...fetching & conversion completed, saved to build/base.html

> nginxconfig.io@1.0.0 build:prism
> node src/nginxconfig/build/prism.js


> nginxconfig.io@1.0.0 build:static
> copyfiles --up 2 src/static/{*,**/*} dist


> nginxconfig.io@1.0.0 build:tool
> vue-cli-service build src/nginxconfig/mount.js --no-clean

All browser targets in the browserslist configuration have supported ES module.
Therefore we don't build two separate bundles for differential loading.


⠏  Building for production...(node:9490) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API
(Use `node --trace-deprecation ...` to show where the warning was created)
⠋  Building for production...


 WARNING  Compiled with 3 warnings                                                                                                                             下午2:31:07

 warning  in ./src/nginxconfig/scss/style.scss

Module Warning (from ./node_modules/_postcss-loader@6.2.1@postcss-loader/dist/cjs.js):
Warning

(1:300915) autoprefixer: Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated.

 warning  

asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  fonts/Inter-Light.ttf (281 KiB)
  fonts/Inter-Regular.ttf (281 KiB)
  fonts/Inter-Medium.ttf (285 KiB)
  fonts/Inter-Bold.ttf (287 KiB)
  css/app.css (308 KiB)
  js/chunk-vendors.js (266 KiB)

 warning  

entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  app (778 KiB)
      js/chunk-vendors.js
      css/app.css
      js/app.js


Webpack Bundle Analyzer saved report to /root/project/nginxconfig.io/dist/report.html
  File                        Size                                                                 Gzipped

  dist/js/chunk-vendors.js    265.72 KiB                                                           92.74 KiB
  dist/js/app.js              203.77 KiB                                                           44.36 KiB
  dist/js/950.js              16.51 KiB                                                            5.89 KiB
  dist/js/416.js              13.01 KiB                                                            5.02 KiB
  dist/js/218.js              12.95 KiB                                                            4.97 KiB
  dist/js/7.js                12.93 KiB                                                            4.99 KiB
  dist/js/33.js               12.86 KiB                                                            5.02 KiB
  dist/js/357.js              12.67 KiB                                                            5.19 KiB
  dist/js/274.js              11.33 KiB                                                            5.24 KiB
  dist/js/724.js              11.27 KiB                                                            5.23 KiB
  dist/js/601.js              2.75 KiB                                                             1.30 KiB
  dist/js/975.js              2.37 KiB                                                             1.16 KiB
  dist/css/app.css            308.48 KiB                                                           39.08 KiB

  Images and other types of assets omitted.
  Build at: 2022-05-09T06:31:09.655Z - Hash: f316b7afd69fabb6 - Time: 19891ms

 DONE  Build complete. The dist directory is ready to be deployed.
 INFO  Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html

配置一个nginx 虚拟站点访问dist目录(nginx 根目录)

# cnpm run build 生成dist目录
[root@node-nfs nginxconfig.io]# ll
总用量 1504
drwxr-xr-x.    2 root root      58 5月   9 14:24 build
-rw-r--r--.    1 root root    1069 5月   9 14:12 LICENSE
drwxr-xr-x. 1284 root root   90112 5月   9 14:22 node_modules
-rw-r--r--.    1 root root    3282 5月   9 14:12 package.json
-rw-r--r--.    1 root root 1385565 5月   9 14:12 package-lock.json
-rw-r--r--.    1 root root    5964 5月   9 14:12 README.md
drwxr-xr-x.    4 root root      39 5月   9 14:12 src
drwxr-xr-x.    2 root root      36 5月   9 14:12 test
drwxr-xr-x.    2 root root      36 5月   9 14:12 dist
-rw-r--r--.    1 root root    3536 5月   9 14:12 vue.config.js

# 将dist目录作为一个虚拟站点根路径
[root@node-nfs nginxconfig.io]# mkdir /home/wwwroot/nginxconfig.xadocker.cn
[root@node-nfs nginxconfig.io]# mv dist /home/wwwroot/nginxconfig.xadocker.cn
[root@node-nfs nginxconfig.io]# chown nginx:nginx -R /home/wwwroot/nginxconfig.xadocker.cn

# 创建nginx 虚拟站点配置
[root@node-nfs nginxconfig.io]# cat >/etc/nginx/conf.d/nginxconfig.xadocker.cn.conf<<'EOF'
server {
    listen      80;
    listen      [::]:80;

    index index.html;
    server_name nginxconfig.xadocker.cn;

    # security
    # include     nginxconfig.io/security.conf;

    # logging
    access_log  /var/log/nginx/nginxconfig.xadocker.cn.access.log;
    error_log   /var/log/nginx/nginxconfig.xadocker.cn.error.log warn;

    # additional config
    # include     nginxconfig.io/general.conf;
}
EOF

[root@node-nfs nginxconfig.io]# nginx -t && nginx -s reload

测试访问

Nginx可视化配置工具NginxConfig
1
xadocker
版权声明:本站原创文章,由 xadocker2022-05-09发表,共计17911字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)
验证码
载入中...