[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$fh4IlBFKxV9_AKVMJ6JpP68TxWNvjW2e5_BEpOKa4zKk":3},{"code":4,"message":5,"data":6},200,"成功",{"id":7,"createdAt":8,"title":9,"content":10,"summary":11,"image":12,"uid":13,"user":14,"categoryId":21,"category":22,"subCategoryId":24,"subCategory":25,"comments":27,"status":17,"reason":28,"notice":28,"visitCount":29,"commentCount":30,"keywords":31},19,"2024-01-23T07:36:10.978Z","在Mac上原生玩一把Nginx","## 流程\n### 1. 本地创建文件夹\n```terminal\nmkdir -p backEnd\ncd backEnd\n```\n\n### 2. 下载nginx\n```terminal\nwget http://nginx.org/download/nginx-1.17.10.tar.gz\n```\n\n如果没有wget工具，那么下载wget:\n- centOS上使用：\n```terminal\nyum install -y wget\n```\n- MacOS上使用：\n```terminal\nbrew install wget\n```\n\n### 3. 解压缩\n```terminal\ntar -zxvf nginx-1.17.10.tar.gz\n```\n \n### 4. 查看最近一次命令是否执行成功\n```terminal\necho $?\n```\n\n### 5. 编译nginx\n```terminal\ncd nginx-1.17.10\n./configure && make && make install\n# 如果提示需要perl环境，那么执行以下命令\nbrew install -y pcre pcre-devel\n# 如果需要指定将nginx编译到某一个文件夹，可以执行以下命令\nmkdir nginx // 这里的nginx指的是当前目录下的文件夹\n./configure --prefix=../nginx\n```\n### 6. 查看nginx是否被设置了环境变量\n```terminal\nwhich nginx\n```\n\n### 7. 查看当前目录下的文件及文件夹的详细描述\n```terminal\nll\n```\n\n### 8. 查看当前运行的nginx进程\n```terminal\nps -ef | grep nginx\n# 查看mysql进程\nps -ef | grep mysql\n```\n\n### 9. centOS中设置nginx命令\n```terminal\n// linux系统的环境变量一般都在profile文件中，例如Mac的.bash_profile文件等\n// centos中存放在/etc/profile文件中\n\n// 1.进入etc目录，打开profile并编辑\n[root@VM-4-14-centos etc]# vi profile\n\n// 2. 在profile文件中的export 语句后面新增一条语句\n# 这里的\"nginx_pkg/nginx-d/sbin/\"需要替换成你自己nginx编译安装之后的nginx可执行文件所在的目录\nexport PATH=$PATH:/root/nginx_pkg/nginx-d/sbin/\n// 3. 编辑profile完成后，点esc后输入:wq保存退出；\n// 4. 更新profile使生效\n[root@VM-4-14-centos etc]source profile\n// 5. 测试nginx是否配置成功\n[root@VM-4-14-centos etc]nginx -t\n```\n\n## 可能遇到的问题\n> nginx: [alert] could not open error log file: open() \"../nginx-d/logs/error.log\" failed (2: No such file or directory)\n\n类似下图：\n![nginx错误截图](https://image.xinwei.ltd/11705994858459.png)\n\n解决方法：\n1.检查截图所指路径下是否有error.log文件，若无则在所指的目录(../nginx-d/logs/)下，新建error.log文件\n```terminal\ntouch error.log\n```\n\n2. 修改logs文件夹的权限\n```terminal\nchmod 700 logs\n```\n\n3. 测试是否解决，下图显示已经成功。\n![nginx测试结果](https://image.xinwei.ltd/21705994960210.png)\n\n\n\n\n","流程 1. 本地创建文件夹 terminal mkdir -p backEnd cd backEnd  2. 下载nginx terminal wget http://nginx.org/download/nginx-1.17.10.tar.gz 如果没有wget工具，那么下载wget: - centOS上使用： terminal yum install -y wget - MacOS上使用： t","https://image.xinwei.ltd/11705994858459.png",499668042977349,{"phone":15,"userId":13,"nickName":16,"vipType":17,"avatar":18,"sign":19,"createdAt":20},"13121171998","全栈老韩",1,"https://image.xinwei.ltd/images/IMG_5430.JPG","全栈工程师，擅长iOS App开发、前端（vue、react、nuxt、小程序&Taro）开发、Flutter、React Native、后端（midwayjs、golang、express、koa）开发、docker容器、seo优化等。","2024-01-01T16:14:30.305Z",2,{"id":21,"name":23},"IT技术",30,{"id":24,"name":26,"parentId":21},"Nginx",[],"",107,0,"mac,mac上nginx,nginx,制作nginx,mac上的nginx"]