建站服务器
下载对应当前系统版本的nginx包(package)
# wget http://nginx.org/packages/centos/7/noarch/rpms/nginx-release-centos-7-0.el7.ngx.noarch.rpm
建立nginx的yum仓库
# rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
下载并安装nginx
# yum install nginx
启动nginx服务
systemctl start nginx
配置
默认的配置文件在 /etc/nginx 路径下,使用该配置已经可以正确地运行nginx;如需要自定义,修改其下的 nginx.conf 等文件即可。
测试
在浏览器地址栏中输入部署nginx环境的机器的ip,如果一切正常,应该能看到如下字样的内容。
usernginx;
worker_processes1;
error_log/var/log/nginx/error.logwarn;
pid/var/run/nginx.pid;
events{
worker_connections1024;
}
http{
include/etc/nginx/mime.types;
default_typeapplication/octet-stream;
log_formatmain\\\’$remote_addr–$remote_user[$time_local]$request\\\’
\\\’$status$body_bytes_sent$http_referer\\\’
\\\’$http_user_agent$http_x_forwarded_for\\\’;
access_log/var/log/nginx/access.logmain;
sendfileon;
#tcp_nopushon;
keepalive_timeout65;
#gzipon;
#include/etc/nginx/conf.d/*.conf;
#设定负载均衡服务器列表
upstreamgroup1{
#后端服务器访问规则
#ip_hash;
#weight参数表示权重值,权值越高被分配到的几率越大
#pc_local
server192.168.187.133:80weight=5;
#pc_server
server192.168.187.134:80weight=5;
}
server{
listen81;#设置对外端口
server_name192.168.187.133;#设置识别请求域名
location/{
#定义服务器的默认网站根目录位置
#roothtml;
#定义首页索引文件的名称
#indexindex.htmlindex.htmindex.php;
proxy_passhttp://group1;#分流到group1集群
}
}
}
我司本案号下有两个网站和ssl证书如何安装,都有哪些申请步骤?网站注册信息怎么查?域名申请要注意哪些问题?云服务器ecs的购买步骤华为云服务器ecs是虚拟机吗买域名的网站哪个好 买域名要注意哪些问题阿里云服务器会自动续费吗这3种无服务器缺点:云提供商绝对不会提及