在腾讯云上部署nginx
来源:互联网 发布:阿里云服务器代购 编辑:程序博客网 时间:2024/05/19 23:54
wget url
yum install gcc gcc-c++ autoconf automake
yun -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel (安装依赖zlib、openssl和pcre)
创建启动nginx的进程用户:
groupadd nginx
useradd -r -g nginx nginx
Linux下各种依赖都已经安装,是因为没有找到makefile。
如果是自己写的,确定在当前目录下;如果是源码安装,先运行./configure,生成makefile,再执行make,即可正常运行
make && make install
配置写入:
–with-xxx 代表默认没有打开的功能
–without-xxx 代表默认打开的功能
–prefix=path 代表安装路径
–sbin-path=path sbin路径
–conf-path 配置文件
–pid-path 代表进程号保存文件
–error-log-path错误日志
–lock-path 锁文件
–user ps看到的启动进程用户
–group ps看到的启动进程用户所在组
–with-http_ssl_module
–with-http_flv_module
不写为默认
sed -e "s|%%PREFIX%%|/usr/local/nginx|" \ -e "s|%%PID_PATH%%|/usr/local/nginx/logs/nginx.pid|" \ -e "s|%%CONF_PATH%%|/usr/local/nginx/conf/nginx.conf|" -e "s|%%ERROR_LOG_PATH%%|/usr/local/nginx/logs/error.log|"
启动 cd /usr/local/nginx/sbin
./nginx
出现80端口占用的问题
检查: Nginx是否配置正确:
./nginx/sbin/nginx -t
Nginx是否成功启动:
ps -ef | grep nginx,查看是否有Nginx的进程
netstat -ntl,查看是否有80端口
Ping测试连通性:
ping x.x.x.x (ip地址)
Telnet测试端口是否可用:
telnet x.x.x.x 80
原因:腾讯云默认80未开放
在腾讯云安全组开放80端口:
在云服务器-安全组,
编辑规则
最后记得在该规则里添加该云主机,在规则->管理云主机->将云主机添加进去
出现系统程序占用80端口的问题?
/usr/local/nginx 下的conf中修改 server的监听端口为880
或者
losf -i:80 查出占用端口的程序
为httpd
service httpd stop 关闭服务
service httpd status 查看是否成功关闭
find /etc/httpd/ -name *conf 查找httpd配置文件的位置
vim /etc/httpd/conf/httpd.conf 编辑文件 –修改Listen 为你想要的为使用的如881–wq保存退出
service httpd start 启动服务
检查配置文件是否正确
cd /usr/nginx/sbin/
./nginx -t
重启nginx
/usr/nginx/sbin/nginx -s reload
查看hosts 文件 cat /etc/hosts,修改hosts文件 vi /etc/hosts
- 在腾讯云上部署nginx
- 在腾讯云上部署应用
- 在腾讯云上部署Hexo博客
- 在腾讯云Winserver2016上部署网站
- 在腾讯云上部署项目
- 在腾讯云上部署tomcat+java+mysql项目
- 在腾讯云的Ubuntu上安装并启动nginx
- Node.js+MongoDB+Nginx在腾讯云的CentOS的部署
- Flask部署到腾讯云主机上
- javaweb项目部署到腾讯云上
- 基于腾讯云服务器上项目部署
- [nginx] 在 Linux 服务器上部署 nginx 之后不能访问
- 从0开始在腾讯云上部署一个 flask 项目
- 如何在腾讯云上部署 Facebook的ParlAI训练框架
- 在腾讯云主机部署Play应用
- azure 云上安装部署nginx
- Centos7上部署nginx
- 在阿里云ECS上部署 Django+MySQL+uWSGI+Nginx 项目的基本流程
- mybatis学习笔记(五) -- maven+spring+mybatis从零开始搭建整合详细过程(上)(附demo和搭建过程遇到的问题解决方法)
- T00001 A+B问题
- Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement' 的解决办法
- Android 6.0 和 7.0 储存空间适配小结
- linux修改静态ip
- 在腾讯云上部署nginx
- 巧用notepad++ 批量转换ansi 和 utf8
- gcc中预定义的宏__GNUC__
- CVPR2017之ActionVLAD(对特征整合方式的改进)
- Git基础篇
- Sersync启动脚本
- 5,工厂方法模式
- C#程序员经常用到的10个实用代码片段
- DG-11G-CentOS7.2-备库开库报错ORA-10458