1.新建一个前端任务到 Jenkins
点击新建任务,点击构建一个自由风格的软件项目,点击ok
2.配置
3.NGINX配置
1.登录
2. 配置请求后台接口
3.配置打包后的前端文件
4.操作写入命令
打开VIM之后,按一下insert键或者i键就可以进入输入状态了。
#vi a.txt
退出的时候先按Esc键,出来冒号就可以敲命令,
q! 回车 不保存
wq 保存
x 保存
4.nginx常用操作命令
启动:
cd usr/local/nginx/sbin
./nginx
(或试试:./nginx -c /etc/nginx/nginx.conf)
重启:
更改配置重启nginx
kill -HUP 主进程号或进程号文件路径 或者 使用
cd /usr/local/nginx/sbin
./nginx -s reload
判断配置文件是否正确:
nginx -t -c /usr/local/nginx/conf/nginx.conf
或者
cd /usr/local/nginx/sbin
./nginx -t
关闭:
cd /usr/local/nginx/sbin
./nginx -s stop
查询nginx主进程号
ps -ef | grep nginx
从容停止 kill -QUIT 主进程号
快速停止 kill -TERM 主进程号
强制停止 kill -9 nginx
若nginx.conf配置了pid文件路径,如果没有,则在logs目录下
kill -信号类型 '/usr/local/nginx/logs/nginx.pid'
5.配置实例
#user nobody;
user root;
worker_processes 32;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
client_max_body_size 2048m;
include mime.types;
default_type application/octet-stream;
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 /mydata/nginx/logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name 10.57.141.13;
#charset koi8-r;
#access_log logs/host.access.log main;
location /oscenter {
proxy_pass http://localhost:8081/oscenter;
#Proxy Setting
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /oscenter_api {
proxy_pass http://localhost:8081/oscenter_api;
#Proxy Setting
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /os_web {
proxy_pass http://localhost:8081/os_web;
#Proxy Setting
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /os_api {
proxy_pass http://localhost:8081/os_api;
#Proxy Setting
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /account/ {
proxy_pass http://localhost:8050/;
#proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /account-admin/ {
proxy_pass http://localhost:8965/;
#proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /mpush-alloc/ {
proxy_pass http://localhost:9999/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /push_web {
proxy_pass http://localhost:10041/;
#Proxy Setting
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /osiam {
proxy_pass http://localhost:8885/;
#Proxy Setting
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /push_temp/ {
proxy_pass http://localhost:10042/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /advert/ {
proxy_pass http://localhost:10049/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /appstore {
proxy_pass http://localhost:8088/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /appstore-api {
proxy_pass http://localhost:8089/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /osiam-web {
alias /usr/data/www/osiam-web/;
index index.html;
try_files $uri $uri/ @rewrites4;
}
location /sport-health-api {
proxy_pass http://localhost:7070/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /sport-health-server {
proxy_pass http://localhost:7080/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ^~/sport-health-web/ {
alias /opt/sprothealth/web/;
index index.html;
try_files $uri $uri/ @rewrites-sport;
}
location @rewrites-sport {
rewrite ^/(sport-health-web)/(.+)$ /$1/index.html last;
}
location @rewrites4 {
rewrite ^/(osiam-web)/(.+)$ /$1/index.html last;
}
#静态文件由nginx处理
#location ~* \.(html|css|js|png|jpg|gif|ico|zip)$ {
# root /usr/data/file;
#}
# fastdfs
# 监听域名中带有group0 到 group9 的,交给fastdfs-nginx-module模块处理
location ~/group[0-9]/ {
ngx_fastdfs_module;
}
location /fastdfs {
proxy_pass http://10.57.141.13:22122;
}
location /osserver-web/ {
alias /usr/data/www/osserver-web/;
index index.html;
try_files $uri $uri/ @rewrites;
}
location @rewrites {
rewrite ^/(osserver-web)/(.+)$ /$1/index.html last;
}
location ^~/push/ {
alias /usr/data/www/push/;
index index.html;
try_files $uri $uri/ @rewrites2;
}
location @rewrites2 {
rewrite ^/(push)/(.+)$ /$1/index.html last;
}
location ^~/osapp-web/ {
alias /usr/data/www/osapp-web/;
index index.html;
try_files $uri $uri/ @rewrites3;
}
location ^~/oscontent-web/ {
alias /usr/data/www/oscontent-web/;
index index.html;
try_files $uri $uri/ @oscontent-rewrites;
}
location @oscontent-rewrites {
rewrite ^/(oscontent-web)/(.+)$ /$1/index.html last;
}
location @rewrites3 {
rewrite ^/(osapp-web)/(.+)$ /$1/index.html last;
}
#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;
# }
#}
#include /etc/nginx/tcpvhost/*.conf;
}