1、nginx下部署网站

网站为:http://10.1.75.177:8000

nginx端口为80

配置如下:

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid; include /usr/share/nginx/modules/*.conf; events {
worker_connections 1024;
} http {
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 /var/log/nginx/access.log main; sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048; include /etc/nginx/mime.types;
default_type application/octet-stream; upstream webServer {
server 10.1.75.177:8000;
} server {
listen 80;
server_name 10.1.75.177; location / {
proxy_pass http://webServer/;
proxy_set_header Host $host:$server_port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
} error_page 404 /404.html;
location = /40x.html {
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
} }

  

含义说明:

https://www.runoob.com/w3cnote/nginx-setup-intro.html

2、nginx为web站点的访问设置账户和密码

http://www.04007.cn/article/605.html(重点参考)

https://www.cnblogs.com/wangxiaoqiangs/p/6184181.html(其他参考)

原配置
auth_basic_user_file /opt/modules/nginx/htpas;
修改为
auth_basic_user_file /opt/modules/nginx/htpas/htpasswd;

创建密码:nginx 123456

cd  /opt/modules/nginx/htpas/

/usr/bin/htpasswd -bdc htpasswd nginx 123456

创建账号后,重启nginx
nginx -s stop
nginx

再次访问nginx下的web,需要账号和密码

nginx小结的更多相关文章

  1. 快速掌握Nginx(一) —— 安装Nginx和简单配置虚拟主机

    Nginx安装和简单配置虚拟主机 1 Nginx简介 Nginx是近几年最火热的http.反向代理服务器,百度阿里等互联网公司也都在使用Nginx,它也可以用作邮件代理服务器.TCP/UDP代理服务器 ...

  2. 【01】Nginx:编译安装/动态添加模块

    写在前面的话 说起 Nginx,别说运维,就是很多开发人员也很熟悉,毕竟如今已经 2019 年了,Apache 更多的要么成为了历史,要么成为了历史残留. 我们在提及 Nginx 的时候,一直在强调他 ...

  3. 161028、Nginx负载均衡实现tomcat集群方案简要小结

    重点两部分:一.负载均衡二.tomcat集群 所谓tomcat集群,就是可以向外提供并行服务的多台机器,任何一台服务器宕机,其它服务器可以替代它向外提供服务,而不影响用户访问. Nginx是一个常用的 ...

  4. Nginx配置小结

    前两天区听了一堂Nginx的课,然后翻了一下自己之前的Nginx的笔记,做了一个简单的小结. 全局变量 $args : 这个变量等于请求行中的参数,同$query_string $content_le ...

  5. nginx虚拟主机配置小结

    nginx的安装在lnmp环境搭建中已经介绍过了,配置文件在安装目录下的conf子目录下,主要主要分成四部分:main(全局设置).server(主机设置).upstream(负载均衡服务器设置).l ...

  6. tomcat结合nginx使用小结

    相信很多人都听过nginx,这个小巧的东西慢慢地在吞食apache和IIS的份额.那究竟它有什么作用呢?可能很多人未必了解. 说到反向代理,可能很多人都听说,但具体什么是反向代理,很多人估计就不清楚了 ...

  7. nginx有关.htaccess小结

    可能很多朋友都常用nginx不支持.htaccess,只有apache才支持.htaccess文件,其实这是错误的看法nginx也是支持.hatccess的哦. 其实nginx和.htaccess一点 ...

  8. nginx+php-fpm的socket配置小结

    关于socket的介绍本文不再赘述,生产环境中常用socket方式,本文简述其配置方式. #cd /app/local/php#切换到php安装目录下 #mkdir run #chmod 777 ./ ...

  9. Nginx支持多站点配置小结

    如何配置 web 服务器才能在一个 VPS 上放置多个网站/博客呢?如何通过一个 IP 访问多个站点/域名呢?这是大多数 web 服务器支持的 virtual hosting 功能.即一个IP对应多个 ...

随机推荐

  1. Maven依赖包导入错误(IntelliJ IDEA):java.lang.OutOfMemoryError: GC overhead limit exceeded

    一.问题背景 最近用IntelliJ IDEA 打开一个老应用,一直加载依赖不成功,主POM中存在如下错误. java.lang.OutOfMemoryError:GC overhead limit ...

  2. C++ unordered_set运用实例

    C++ unordered_set运用实例 #include <unordered_set> #include <numeric> #include "print.h ...

  3. async异步流程控制神器

    async https://www.npmjs.com/package/async Async is a utility module which provides straight-forward, ...

  4. JMETER - 连接MySQL数据库_函数助手_随机登录

    1. 导入mysql-connect.jar包 2. 添加配置原件-jdbc connection config 3. 添加jdbc请求 填写信息 4. 连接数据库 OK 5. 增加语句:jdbc r ...

  5. jenkins自动化视频地址

    1.腾讯课堂的视频 http://www.ctnrs.com/study.html 我的课程所有列表 2.百度网盘里面的

  6. [转]How to Install Oracle Java 11 in Ubuntu 18.04/18.10

    链接地址:http://ubuntuhandbook.org/index.php/2018/11/how-to-install-oracle-java-11-in-ubuntu-18-04-18-10 ...

  7. 使用垃圾桶机制防止rm -rf误删文件

    偶然看到一个比较好用的工具Trash-Cli.一个类似垃圾桶的机制,可以恢复文件.试了一下,感觉还行 (1)下载安装: https://github.com/andreafrancia/trash-c ...

  8. java 查看类是从哪个jar包加载的

    package com.jason object FIndjar { def main(args: Array[String]): Unit = { val pd = classOf[org.apac ...

  9. graph处理工具

    仅作为记录笔记,完善中...................... 1       PyGSP https://pygsp.readthedocs.io/en/stable/index.html ht ...

  10. Nginx为什么可以支持高并发

    Nginx是由一个俄罗斯人专门为解决高并发而开发的 nginx 采用的是多进程+epoll,能实现高并发,其可以支持的并发上限大概是同时支持5W个连接 1 多进程 nginx 在启动后,会有一个 ma ...