04-nginx服务器的安装,redis安装,前端部署
来源:互联网 发布:老人坐便椅子淘宝网 编辑:程序博客网 时间:2024/05/17 00:09
nginx服务器的安装
wget http://nginx.org/download/nginx-1.10.0.tar.gztar -xvf nginx-1.10.0.tar.gzwget http://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gztar -xvf ngx_cache_purge-2.3.tar.gzgroupadd -r nginxadduser -r -d /var/cache/nginx -s /sbin/nologin -g nginx nginxyum -y install zlib zlib-devel openssl openssl-devel pcre pcre-develPRGDIR=`pwd`cd nginx-1.10.0./configure \--prefix=/etc/nginx \--sbin-path=/usr/sbin/nginx \--modules-path=/usr/lib/nginx/modules \--conf-path=/etc/nginx/nginx.conf \--error-log-path=/var/log/nginx/error.log \--http-log-path=/var/log/nginx/access.log \--pid-path=/run/nginx.pid \--lock-path=/run/nginx.lock \--http-client-body-temp-path=/var/cache/nginx/client_temp \--http-proxy-temp-path=/var/cache/nginx/proxy_temp \--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \--http-scgi-temp-path=/var/cache/nginx/scgi_temp \--user=nginx \--group=nginx \--with-http_ssl_module \--with-http_realip_module \--with-http_addition_module \--with-http_sub_module \--with-http_dav_module \--with-http_flv_module \--with-http_mp4_module \--with-http_gunzip_module \--with-http_gzip_static_module \--with-http_random_index_module \--with-http_secure_link_module \--with-http_stub_status_module \--with-http_auth_request_module \--with-threads \--with-stream \--with-stream_ssl_module \--with-http_slice_module \--with-mail \--with-mail_ssl_module \--with-file-aio \--with-http_v2_module \--with-ipv6 \--add-module=$PRGDIR/ngx_cache_purge-2.3makesudo make installrm -rf /etc/nginx/html/mkdir -p /etc/nginx/conf.d/ /usr/share/nginx/html/install -m644 html/index.html /usr/share/nginx/html/install -m644 html/50x.html /usr/share/nginx/html/
nginx -t
可以查看nginx服务器的配置文件的语法是否正确,
也可以看到nginx配置文件的地址。
nginx -c nginx.conf 指定配置文件的地址
nginx -s reload 重启nginx服务器,在修改了配置文件之后。
nginx -s stop 停止nginx服务器
nginx -s start 启动nginx服务器
nginx 配置文件
#声明用户为nobodyuser nobody;#开启nginx工作进程数,一般为1#可以通过ps -ef | grep nginx 查看到有4个工作进程worker_processes 4;#设置并发数events{ #设置最大并发数 worker_connections 1024;}http{ upstream bro-prj{ server localhost:8080; } include mime.types; default_type application/octet-stream; server { listen 80; server_name 118.190.159.49; charset utf-8; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location = / { root /opt/bro-prj/www; index index.html index.htm; } location = /index { root /opt/bro-prj/www; rewrite ^(.*) /; } location ~ .*\.(html)$ { root /opt/bro-prj/www; index index.html index.htm; } location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|woff|woff2|svg|ttf)$ { root /opt/bro-prj/www; index index.html index.htm; } location ~ .*(css)$ { root /opt/bro-prj/www; index index.html index.htm; } location ~ /script/(user|role|syslog|wordbooks)\.js$ { proxy_pass http://bro-prj; proxy_set_header Host $host:$server_port; } location = /script/wordbooks.js { proxy_pass http://bro-prj; proxy_set_header Host $host:$server_port; } location / { proxy_pass http://bro-prj; proxy_set_header Host $host:$server_port; }}}
安装redis
安装gcc
yum -y install gcc gcc-c++ kernel-devel
安装配置redissudo groupadd -r redissudo adduser -r -s /sbin/nologin -g redis redismkdir -p /opt/redis/dbchown -R redis:redis /opt/rediscd ~wget http://download.redis.io/releases/redis-3.2.2.tar.gztar -xzvf redis-3.2.2.tar.gzcd redis-3.2.2makesudo make installsudo mkdir -p /usr/local/etc/redissudo cp redis.conf /usr/local/etc/redis/ipaddr=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -E '^(192|172|10)\.'`sudo sed -i "s/bind 127.0.0.1/bind 127.0.0.1 $ipaddr/" /usr/local/etc/redis/redis.confnohup redis-server /usr/local/etc/redis/redis.conf &
验证,查看redis的进程
ps -ef | grep redis
前台部署
- build构建html页面
- 将build下面的html页面复制出来
- 将公共的pub里面的html页面cp替换服务器上面的文件
ps: 可能出现的问题
Resource interpreted as stylesheet but transferred with MIME type text/html (seems not related with web server)
去掉rel=”stylesheet”
再还原一下,当时就是这样解决的,也不知道是什么原因呢。
阅读全文
0 0
- 04-nginx服务器的安装,redis安装,前端部署
- 第二章 Nginx服务器的安装部署
- nginx服务器安装及部署
- Redis缓存服务器安装部署
- Redis的安装部署
- Nginx服务器的安装部署和框架简介
- 第二章 Nginx服务器的安装部署【上】
- 第二章 Nginx服务器的安装部署【下】
- 第2章 Nginx服务器的安装部署
- Nginx服务器的安装
- Nginx服务器的安装
- Redis的服务器安装
- Nginx安装手册以及图片服务器部署
- Nginx 安装以及图片服务器简单部署
- linux 服务器部署 lnamp 一nginx安装
- mac系统 安装部署启动redis服务器
- Nginx的安装和部署
- Nginx的安装与部署
- Python自然语言处理入门
- 用工具解决BUG XDeBug
- Oracle基础
- 搭建FTP文件服务
- PHP之static静态变量详解(二)
- 04-nginx服务器的安装,redis安装,前端部署
- 几本自然语言处理入门书
- Oracle 基础
- 使用npm install报错-4048 operation not permitted解决
- 让 UIView 显示一个图片
- 深度学习在自然语言处理的应用
- 菜鸟学习微信小程序之数据绑定
- python mysql 字段与关键字冲突解决
- Spring Framework 5.0.0下载