-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from devsapp/add-nginx
add nginx
- Loading branch information
Showing
11 changed files
with
501 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
web-framework/nodejs/custom-runtime/nest | ||
web-framework/nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
async function preInit(inputObj) { | ||
console.log(` | ||
Serverless Devs Application Case | ||
Cloud services required: | ||
- FC : https://fc.console.aliyun.com/ | ||
Tips: | ||
- Serverless Devs Version >= v2.0.103 | ||
- FC Component: https://www.serverless-devs.com/fc/readme | ||
`) | ||
} | ||
|
||
async function postInit(inputObj) { | ||
console.log(` | ||
* Before using, please check whether the actions command in Yaml file is available | ||
* Carefully reading the notes in s.yaml is helpful for the use of the tool | ||
* FC is only used as the execution environment, and the business code is in NAS | ||
* If need help in the use process, please apply to join the Dingtalk Group: 33947367 | ||
`) | ||
} | ||
|
||
module.exports = { | ||
postInit, | ||
preInit | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
Type: Application | ||
Name: start-nginx | ||
Provider: | ||
- 阿里云 | ||
Version: 0.0.1 | ||
Description: 快速部署 nginx 到函数计算 | ||
HomePage: https://github.com/devsapp/start-web-framework | ||
Tags: | ||
- Web框架 | ||
- nginx | ||
Category: Web框架 | ||
Service: | ||
函数计算: | ||
Authorities: | ||
- AliyunFCFullAccess | ||
Parameters: | ||
type: object | ||
additionalProperties: false # 不允许增加其他属性 | ||
required: # 必填项 | ||
- region | ||
- serviceName | ||
- functionName | ||
properties: | ||
region: | ||
title: 地域 | ||
type: string | ||
default: cn-hangzhou | ||
description: 创建应用所在的地区 | ||
enum: | ||
- cn-beijing | ||
- cn-hangzhou | ||
- cn-shanghai | ||
- cn-qingdao | ||
- cn-zhangjiakou | ||
- cn-huhehaote | ||
- cn-shenzhen | ||
- cn-chengdu | ||
- cn-hongkong | ||
- ap-southeast-1 | ||
- ap-southeast-2 | ||
- ap-southeast-3 | ||
- ap-southeast-5 | ||
- ap-northeast-1 | ||
- eu-central-1 | ||
- eu-west-1 | ||
- us-west-1 | ||
- us-east-1 | ||
- ap-south-1 | ||
serviceName: | ||
title: 服务名 | ||
type: string | ||
default: web-framework | ||
description: 服务名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-128 之间 | ||
functionName: | ||
title: 函数名 | ||
type: string | ||
default: nginx | ||
description: 函数名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-64 之间 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./src/readme.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
|
||
#user nobody; | ||
#Defines which Linux system user will own and run the Nginx server | ||
|
||
worker_processes auto; | ||
#Referes to single threaded process. Generally set to be equal to the number of CPUs or cores. | ||
|
||
#error_log logs/error.log; #error_log logs/error.log notice; | ||
#Specifies the file where server logs. | ||
|
||
#pid logs/nginx.pid; | ||
#nginx will write its master process ID(PID). | ||
|
||
events { | ||
worker_connections 1024; | ||
# worker_processes and worker_connections allows you to calculate maxclients value: | ||
# max_clients = worker_processes * worker_connections | ||
} | ||
|
||
|
||
http { | ||
# anything written in /opt/nginx/conf/mime.types is interpreted as if written inside the http { } block | ||
# | ||
|
||
#log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
# '$status $body_bytes_sent "$http_referer" ' | ||
# '"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
#access_log logs/access.log main; | ||
# If serving locally stored static files, sendfile is essential to speed up the server, | ||
# But if using as reverse proxy one can deactivate it | ||
|
||
#tcp_nopush on; | ||
# works opposite to tcp_nodelay. Instead of optimizing delays, it optimizes the amount of data sent at once. | ||
|
||
#keepalive_timeout 0; | ||
keepalive_timeout 900; | ||
# timeout during which a keep-alive client connection will stay open. | ||
|
||
#gzip on; | ||
# tells the server to use on-the-fly gzip compression. | ||
|
||
server { | ||
# You would want to make a separate file with its own server block for each virtual domain | ||
# on your server and then include them. | ||
listen 9000; | ||
#tells Nginx the hostname and the TCP port where it should listen for HTTP connections. | ||
# listen 9000; is equivalent to listen *:9000; | ||
|
||
server_name localhost; | ||
# lets you doname-based virtual hosting | ||
|
||
#charset koi8-r; | ||
|
||
#access_log logs/host.access.log main; | ||
|
||
#error_page 404 /404.html; | ||
|
||
# redirect server error pages to the static page /50x.html | ||
# | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root html; | ||
} | ||
|
||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 | ||
# | ||
#location ~ \.php$ { | ||
# proxy_pass http://127.0.0.1; | ||
#} | ||
|
||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | ||
# | ||
#location ~ \.php$ { | ||
# root html; | ||
# fastcgi_pass 127.0.0.1:9000; | ||
# fastcgi_index index.php; | ||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; | ||
# include fastcgi_params; | ||
#} | ||
|
||
# deny access to .htaccess files, if Apache's document root | ||
# concurs with nginx's one | ||
# | ||
#location ~ /\.ht { | ||
# deny all; | ||
#} | ||
} | ||
|
||
|
||
# another virtual host using mix of IP-, name-, and port-based configuration | ||
# | ||
#server { | ||
# listen 8000; | ||
# listen somename:8080; | ||
# server_name somename alias another.alias; | ||
|
||
# location / { | ||
# root html; | ||
# index index.html index.htm; | ||
# } | ||
#} | ||
|
||
|
||
# HTTPS server | ||
# | ||
#server { | ||
# listen 443 ssl; | ||
# server_name localhost; | ||
|
||
# ssl_certificate cert.pem; | ||
# ssl_certificate_key cert.key; | ||
|
||
# ssl_session_cache shared:SSL:1m; | ||
# ssl_session_timeout 5m; | ||
|
||
# ssl_ciphers HIGH:!aNULL:!MD5; | ||
# ssl_prefer_server_ciphers on; | ||
|
||
# location / { | ||
# root html; | ||
# index index.html index.htm; | ||
# } | ||
#} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# start-nginx 帮助文档 | ||
|
||
<p align="center" class="flex justify-center"> | ||
<a href="https://www.serverless-devs.com" class="ml-1"> | ||
<img src="http://editor.devsapp.cn/icon?package=start-nginx&type=packageType"> | ||
</a> | ||
<a href="http://www.devsapp.cn/details.html?name=start-nginx" class="ml-1"> | ||
<img src="http://editor.devsapp.cn/icon?package=start-nginx&type=packageVersion"> | ||
</a> | ||
<a href="http://www.devsapp.cn/details.html?name=start-nginx" class="ml-1"> | ||
<img src="http://editor.devsapp.cn/icon?package=start-nginx&type=packageDownload"> | ||
</a> | ||
</p> | ||
|
||
<description> | ||
|
||
Z-Blog是由Z-Blog开发团队开发的一款小巧而强大的基于Asp和PHP平台的开源程序,致力于给用户提供优秀的博客写作体验 | ||
|
||
</description> | ||
|
||
<table> | ||
|
||
## 前期准备 | ||
使用该项目,推荐您拥有以下的产品权限 / 策略: | ||
|
||
| 服务/业务 | 函数计算 | 硬盘挂载 | VPC | 其它 | | ||
| --- | --- | --- | --- | --- | | ||
| 权限/策略 | AliyunFCFullAccess | AliyunNASFullAccess | AliyunVPCFullAccess | AliyunECSFullAccess | | ||
|
||
</table> | ||
|
||
<codepre id="codepre"> | ||
|
||
# 代码 & 预览 | ||
|
||
- [ :smiley_cat: 源代码](https://github.com/devsapp/start-web-framework/blob/master/web-framework/nginx) | ||
|
||
</codepre> | ||
|
||
<deploy> | ||
|
||
## 部署 & 体验 | ||
|
||
<appcenter> | ||
|
||
- :fire: 通过 [Serverless 应用中心](https://fcnext.console.aliyun.com/applications/create?template=start-nginx) , | ||
[![Deploy with Severless Devs](https://img.alicdn.com/imgextra/i1/O1CN01w5RFbX1v45s8TIXPz_!!6000000006118-55-tps-95-28.svg)](https://fcnext.console.aliyun.com/applications/create?template=start-nginx) 该应用。 | ||
|
||
</appcenter> | ||
|
||
- 通过 [Serverless Devs Cli](https://www.serverless-devs.com/serverless-devs/install) 进行部署: | ||
- [安装 Serverless Devs Cli 开发者工具](https://www.serverless-devs.com/serverless-devs/install) ,并进行[授权信息配置](https://www.serverless-devs.com/fc/config) ; | ||
- 初始化项目:`s init start-nginx -d start-nginx` | ||
- 进入项目,并进行项目部署:`cd start-nginx && s deploy -y` | ||
|
||
</deploy> | ||
|
||
<appdetail id="flushContent"> | ||
|
||
# 应用详情 | ||
|
||
|
||
本项目是将 nginx 部署到阿里云 Serverless 平台(函数计算 FC)。 | ||
|
||
通过 Serverless Devs 开发者工具,您只需要几步,就可以体验 Serverless 架构,带来的降本提效的技术红利。 | ||
|
||
部署完成之后,您可以看到系统返回给您的案例地址, 此时,打开案例地址,就可以进入 nginx 默认的首页: | ||
|
||
![图片alt](https://img.alicdn.com/imgextra/i3/O1CN01C1yDPT1oBhA7JjW4y_!!6000000005187-2-tps-2090-666.png) | ||
|
||
|
||
|
||
</appdetail> | ||
|
||
<devgroup> | ||
|
||
## 开发者社区 | ||
|
||
您如果有关于错误的反馈或者未来的期待,您可以在 [Serverless Devs repo Issues](https://github.com/serverless-devs/serverless-devs/issues) 中进行反馈和交流。如果您想要加入我们的讨论组或者了解 FC 组件的最新动态,您可以通过以下渠道进行: | ||
|
||
<p align="center"> | ||
|
||
| <img src="https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1635407298906_20211028074819117230.png" width="130px" > | <img src="https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1635407044136_20211028074404326599.png" width="130px" > | <img src="https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1635407252200_20211028074732517533.png" width="130px" > | | ||
|--- | --- | --- | | ||
| <center>微信公众号:`serverless`</center> | <center>微信小助手:`xiaojiangwh`</center> | <center>钉钉交流群:`33947367`</center> | | ||
|
||
</p> | ||
|
||
</devgroup> |
Oops, something went wrong.