Ubuntu部署nginx
nginx是什么
Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务。Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамблер)开发的,公开版本1.19.6发布于2020年12月15日。
其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、简单的配置文件和低系统资源的消耗而闻名。2022年01月25日,nginx 1.21.6发布。
Nginx是一款轻量级的web服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:百度、京东、新浪、网易、腾讯、淘宝等。
开始部署
操作系统:Ubuntu
因为我们已经有nginx,所以可以先查看一下nginx状态
root@iZuf6c3gcnqmp1sehmmseiZ:/etc/nginx# systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy serverLoaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)Active: active (running) since Mon 2022-03-14 02:22:40 CST; 1 weeks 1 days agoDocs: man:nginx(8)Main PID: 76359 (nginx)Tasks: 3 (limit: 4424)Memory: 4.4MCGroup: /system.slice/nginx.service├─76359 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;├─76360 nginx: worker process└─76361 nginx: worker processMar 14 02:22:40 iZuf6c3gcnqmp1sehmmseiZ systemd[1]: Starting A high performance web server and a reverse proxy server...
Mar 14 02:22:40 iZuf6c3gcnqmp1sehmmseiZ systemd[1]: Started A high performance web server and a reverse proxy server.
卸载后重新安装一下:
sudo apt-get remove nginx nginx-common # 卸载删除除了配置文件以外的所有文件。sudo apt-get purge nginx nginx-common # 卸载所有东东,包括删除配置文件。sudo apt-get autoremove # 在上面命令结束后执行,主要是卸载删除Nginx的不再被使用的依赖包。sudo apt-get remove nginx-full nginx-common #卸载删除两个主要的包
#开始卸载
root@iZuf6c3gcnqmp1sehmmseiZ:/etc/nginx# sudo apt-get purge nginx nginx-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:libgd3 libxpm4 libxslt1.1
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:libnginx-mod-http-image-filter* libnginx-mod-http-xslt-filter* libnginx-mod-mail* libnginx-mod-stream* nginx* nginx-common* nginx-core*
0 upgraded, 0 newly installed, 7 to remove and 24 not upgraded.
After this operation, 2,134 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 116310 files and directories currently installed.)
Removing nginx (1.18.0-0ubuntu1.2) ...
Removing nginx-core (1.18.0-0ubuntu1.2) ...
Removing libnginx-mod-http-image-filter (1.18.0-0ubuntu1.2) ...
Removing libnginx-mod-http-xslt-filter (1.18.0-0ubuntu1.2) ...
Removing libnginx-mod-mail (1.18.0-0ubuntu1.2) ...
Removing libnginx-mod-stream (1.18.0-0ubuntu1.2) ...
Removing nginx-common (1.18.0-0ubuntu1.2) ...
Processing triggers for man-db (2.9.1-1) ...
(Reading database ... 116261 files and directories currently installed.)
Purging configuration files for libnginx-mod-mail (1.18.0-0ubuntu1.2) ...
Purging configuration files for libnginx-mod-http-image-filter (1.18.0-0ubuntu1.2) ...
Purging configuration files for libnginx-mod-stream (1.18.0-0ubuntu1.2) ...
Purging configuration files for nginx-common (1.18.0-0ubuntu1.2) ...
dpkg: warning: while removing nginx-common, directory '/var/www/html' not empty so not removed
dpkg: warning: while removing nginx-common, directory '/usr/share/nginx' not empty so not removed
Purging configuration files for libnginx-mod-http-xslt-filter (1.18.0-0ubuntu1.2) ...
Processing triggers for systemd (245.4-4ubuntu3.15) ...
Processing triggers for ufw (0.36-6ubuntu1) ...#查看状态,已经卸载成功
root@iZuf6c3gcnqmp1sehmmseiZ:/etc/nginx# systemctl status nginx
Unit nginx.service could not be found.
root@iZuf6c3gcnqmp1sehmmseiZ:/etc/nginx#
开始安装
sudo apt-get install nginx
再次查看状态:
测试:
成功!
默认配置:
1 user www-data;2 worker_processes auto;3 pid /run/nginx.pid;4 include /etc/nginx/modules-enabled/*.conf;5 6 events {7 worker_connections 768;8 # multi_accept on;9 }10 11 http {12 13 ##14 # Basic Settings15 ##16 17 sendfile on;18 tcp_nopush on;19 tcp_nodelay on;20 keepalive_timeout 65;21 types_hash_max_size 2048;22 # server_tokens off;23 24 # server_names_hash_bucket_size 64;25 # server_name_in_redirect off;26 27 include /etc/nginx/mime.types;28 default_type application/octet-stream;29 30 ##31 # SSL Settings32 ##33 34 ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE35 ssl_prefer_server_ciphers on;36 37 ##38 # Logging Settings39 ##40 41 access_log /var/log/nginx/access.log;42 error_log /var/log/nginx/error.log;43 44 ##45 # Gzip Settings46 ##47 48 gzip on;49 50 # gzip_vary on;51 # gzip_proxied any;52 # gzip_comp_level 6;53 # gzip_buffers 16 8k;54 # gzip_http_version 1.1;55 # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;56 57 ##58 # Virtual Host Configs59 ##60 61 include /etc/nginx/conf.d/*.conf;62 include /etc/nginx/sites-enabled/*;63 }64 65 66 #mail {67 # # See sample authentication script at:68 # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript69 # 70 # # auth_http localhost/auth.php;71 # # pop3_capabilities "TOP" "USER";72 # # imap_capabilities "IMAP4rev1" "UIDPLUS";73 # 74 # server {75 # listen localhost:110;76 # protocol pop3;77 # proxy on;78 # }79 # 80 # server {81 # listen localhost:143;82 # protocol imap;83 # proxy on;84 # }85 #}
域名购买/ssl证书申请
Ubuntu部署nginx相关推荐
- ubuntu下nginx+php5的部署
ubuntu下nginx+php5环境的部署和centos系统下的部署稍有不同,废话不多说,以下为操作记录: 1)nginx安装 root@ubuntutest01-KVM:~# sudo apt-g ...
- Ubuntu配置Nginx部署Vue SPA项目
Ubuntu配置Nginx部署Vue SPA项目 文章记录了部署Vue SPA项目后可从ip访问的过程,因域名访问需要备案暂未尝试,后续若实行亦会更新在此处. 系统为Ubuntu18.04. Ngin ...
- 笔记-Ubuntu部署K8s,启动nginx服务
部署K8s,我切到了root用户进行部署 su root 启动Docker systemctl enable docker systemctl status docker systemctl star ...
- Ubuntu+Django+Nginx+uWSGI+Mysql搭建Python Web服务器
Ubuntu+Django+Nginx+uWSGI+Mysql搭建Python Web服务器 闲着无聊的时候部署了一个Django项目玩,用vm虚拟机部署的. 准备工作 我使用的系统是Ubuntu16 ...
- 在Docker上部署NGINX和NGINX Plus
在Docker上部署NGINX和NGINX Plus 高性能应用程序交付平台NGINX Plus,负载均衡器和Web服务器可通过Docker容器部署. 先决条件 在Docker容器中运行NGINX开源 ...
- .net core部署Nginx集群
文章目录 一.Nginx是什么? 二.使用步骤 1.Linux上安装Nginx 2.查看nginx是否安装成功 3.启动nginx 4.检验 一.Nginx是什么? Nginx是一个高性能的HTTP和 ...
- docker初体验:docker部署nginx负载均衡集群
Docker 是一个用于开发,交付和运行应用程序的开放平台.Docker 使您能够将应用程序与基础架构分开,从而可以快速交付软件.今天来为大家演示一下docker部署nginx负载均衡集群 环境 ce ...
- docker初体验:docker部署nginx服务
Docker 是一个用于开发,交付和运行应用程序的开放平台.Docker 使您能够将应用程序与基础架构分开,从而可以快速交付软件.今天来为大家演示一下docker部署nginx 环境 centos7 ...
- ansible 发部署nginx以及更新、回滚
ansible 发部署nginx以及更新.回滚 ansible 和 saltstack 一样都是基于 Python 开发的,是比 puppet 和 saltstack 更轻量级的运维自动化工具. 一: ...
最新文章
- 获取应用程序路径信息
- LNMP架构php-fpm相关配置
- 转:经典论文翻译导读之《Google File System》
- FreeSwitch安装和配置记录
- 推荐算法炼丹笔记:排序模型CTR点击率预估系列
- 【无套路送书】架构师是怎样炼成的?
- 看了《OCP/OCA认证考试指南全册:Oracle Database 11g(1Z0-051,...
- Storm编程模型总结
- kaggle案例实战班
- python PyEnchant(检查拼写)
- 快递分拣程序 python_顺丰快递分拣程序
- 【已解决】【V3版本】如何使用脚本关闭Win10自动更新服务并阻止其自动启动?
- php免费开发环境搭建,Windows PHP 开发环境搭建
- 使用PreTranslateMessage(MSG* pMsg)截获键盘数字键
- Elastic 7.11 重磅发布:可搜索快照和新冷层的正式版以及读时模式的公测版
- 【火星备份软件】存储架构优势简介
- matlab欧拉法截断误差,一阶常微分方程欧拉法与梯形公式局部截断误差与p阶精度Range.PPT...
- 计算机组成原理第八章知识导图,计算机组成原理第八章课后部分答案图文.pdf...
- 蓝牙模块教程|一文看懂BLE蓝牙模块应用开发,快速入门指南
- http工具类发送post和get请求