Appearance
Nginx Cheetsheet
Nginx官网:nginx.org
阿里云centos7安装Nginx
参考链接:阿里云centos7安装Nginx
- 查看资源库中软件包信息
shell
yum info nginx- 安装Nginx
shell
yum install nginx- 确认安装成功
shell
nginx -v /* 查看安装版本 */
nginx -t /* 查看配置文件是否准确 */- 查找相关目录
shell
whereis nginx- 启动nginx服务
shell
systemctl start nginx.service- 关闭nginx服务
shell
systemctl stop nginx.service- 重启nginx服务
shell
systemctl reload nginx- 查看nginx状态
shell
systemctl status nginx- 编辑配置文件
shell
vim /etc/nginx/nginx.conf- 输入网址测试
在浏览器中输入 http://ip:80 (nginx配置文件默认80端口)

Nginx配置https域名证书
参考链接:nginx配置域名https - 腾讯云开发者社区 - 腾讯云
nginx
server {
listen 443 ssl;
server_name xukaiwen.com;
root /home/xukaiwen/www/html;
ssl_certificate /root/crt/xukaiwen.com.pem;
ssl_certificate_key /root/crt/xukaiwen.com.key;
}
server {
listen 80;
server_name xukaiwen.com;
return 301 https://$host$request_uri;
}