当前位置: 首页 > news >正文

php网站建设开发企业网站开发文档

php网站建设开发,企业网站开发文档,中国八大设计院指的是哪些,网站点击代码1. 查看操作系统有没有安装Nginx which nginx 2. 使用epel的方式进行安装(方法二) 先安装epel sudo yum install yum-utils 安装完成后,查看安装的epel包即可 sudo yum install epel 3 开始安装nginx 上面的两个方法不管选择哪个&…

1. 查看操作系统有没有安装Nginx

 which nginx

2. 使用epel的方式进行安装(方法二)

先安装epel

sudo yum install yum-utils

安装完成后,查看安装的epel包即可

sudo yum install epel

3 开始安装nginx

上面的两个方法不管选择哪个,都可以使用yum进行安装

sudo yum install nginx

4 启动Nginx并进行测试

# 查看nginx版本

$ nginx -v
nginx version: nginx/1.24.0

# 设置开机自启动

$ sudo systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

# 启动nginx
$ sudo systemctl start nginx

在浏览器输入服务器地址 默认端口为80

5. 查找Nginx配置文件,把其他服务器端口指向Nginx默认端口号80

$ whereis nginx.conf
nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz

查看配置文件是否正确
$ sudo nginx -t   
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

位置在 /etc/nginx/nginx.conf

查看include 指向Nginx的配置文件,include /etc/nginx/conf.d/*.conf  养成好习惯,修改之前先备份

/etc/nginx/conf.d 目录下有default.conf 文件

sudo vim /etc/nginx/conf.d/default.conf

添加如下location

查看配置文件是否正确
$ sudo nginx -t   

重启nginx

$ sudo systemctl restart nginx

查看服务器 nginx的log日志

位置

/var/log/nginx

的 access.log error.log

修改权限为777       sudo chmod 777 *.log

在浏览器访问不带端口的地址 http://10.110.xx,xx/devices

10.112.98.23 - - [28/Aug/2023:15:26:44 +0800] "GET /static/vendor/fontawesome-5.7.2/css/fonts/element-icons.ttf HTTP/1.1" 404 69 "http://10.110.xx.xx/static/vendor/fontawesome-5.7.2/css/index.css" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36" "-"

6. 解决nginx访问Permission denied) while connecting to upstream问题

2023/08/28 14:41:51 [crit] 27956#27956: *1 connect() to 10.110.xx.xx:4000 failed (13: Permission denied) while connecting to upstream, client: 10.112.98.23, server: localhost, request: "GET / HTTP/1.1", upstream: "http://10.110.xx.xx:4000/", host: "10.110.xx.xx"

$ sudo vim /etc/selinux/config

但还是不行 

sudo setsebool -P httpd_can_network_connect 1  生效了

5. 其他的一些用法

停止服务:
sudo systemctl restart nginx
重新加载nginx
sudo systemctl reload nginx
打开防火墙的80端口:
firewall-cmd --zone=public --perm

anent --add-service=http 
success


firewall-cmd --reload
success

命令的作用是将 http 服务添加到 public 区域的永久规则中,即允许通过防火墙访问 http 服务。

其中,
–zone=public 指定了作用的区域为 public
–permanent 表示该规则将被永久保存
–add-service=http 指定添加的服务为 http 

7. nginx配置http

  location / {
                 proxy_pass  http://10.110.133.57:4000; # 或 http://www.baidu.com
                 proxy_read_timeout 300s;
                 proxy_set_header Host $host;
                 proxy_set_header X-Real-IP $remote_addr;
                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

8. nginx配置websocket

nginx代理

在 server 节点内,增加如下:

location /websocket {
    proxy_pass http://127.0.0.1:9502;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
}

配置完后,如果 server_name 为 www.test.com,就可以在 JavaScript 中这样访问:

ws://www.test.com/websocket

wss

只需在 server 节点内正常配置 ssl 即可,如下:

ssl on;
ssl_certificate ***.crt;
ssl_certificate_key ***.key;

8. nginx配置静态资源

参考

CentOS7操作系统安装nginx实战(多种方法,超详细)

解决nginx访问问题connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream, - 编程之家

nginx反向代理websocket,nginx配置websocket转发,nginx socket反向代理, nginx支持websocket-腾讯云开发者社区-腾讯云

http://www.yayakq.cn/news/379277/

相关文章:

  • 安卓网站建站系统潍坊网站的公司电话
  • 重庆网站定制哪家好wordpress企业宣传电商
  • asp网站如何发布黄页网云南企业
  • 南通建设网站公司青岛百度网站排名优化
  • 局域网站建设合肥金融网站开发
  • html学校官网代码制作seo工作怎么样
  • 手机网站生成app软件王府井网上商城是正品吗
  • 免费网站建设教程wordpress单页下载
  • 可以建设个人网站怎么叫人做网站
  • 包头土右旗建设局网站大连2021建设网
  • win8风格网站开发实例qingdao城乡住房建设厅网站
  • 招聘类网站怎么做seo是什么意思揉若湖南岚鸿专注
  • 潍坊网站建设优化wordpress 怎么汉化主题
  • 买的服务器做两个网站网站建设湖北
  • 好的买手表网站舟山网站设计公司
  • 做网站免费做网站怎么
  • 旅游网站开发公司做资源下载网站条件
  • 建设银行洛阳市分行网站龙华网站公司
  • 手机网站按那个尺寸做新手如何学代码
  • 忻州 建网站做网站用什么网最好
  • 怎么建设手机电影网站网页设计制作免费
  • 后湖做网站免费ktv网站模板
  • 新手建网站教程网络规划设计师是高级职称吗
  • 梅县区住房和城乡规划建设局网站windows优化大师软件介绍
  • 电脑怎样做轰炸网站牡丹江整站优化
  • 网络广告网站ftp网站 免费
  • qq空间网站是多少网站建设与管理认识
  • 南阳专业做网站公司网站密度
  • 青海建设厅通报网站网站怎么让谷歌收录
  • 自己建的网站如何推广wordpress cookies因预料之外的输出被阻止