从CentOS7的初始状态到在nginx上运行php python perl ruby
从CentOS7的初始状态到在nginx上运行php python perl ruby
技术分享|2022-11-6|最后更新: 2024-12-22
type
status
date
slug
summary
tags
category
icon
password
status (1)
我刚刚在 全新未使用的CentOS7 上安装了nginx,并且让nginx同时运行php文件,py文件,pl文件,rb文件。
由于目的是记录工作历史,所以解释就较少。

工作细节

前期工作

禁用 SELinux。
当我尝试使用上游或代理访问它时,出现了 PermissionDenied,因此我检查了套接字权限等,但我厌倦了它,所以我禁用了 SELinux 并且它起作用了,所以我就这样做了。
当验证和调查各种事情时,删除 SELinux 需要时间。。。

包安装

安装每个脚本和包以将其作为 CGI 运行。
当调用python perl ruby脚本时调用fcgi。
当调用php脚本时,将调用PHP-FPM。
nginx 设置
准备spawn-fcgi 配置文件以将fcgi 包装器作为服务运行。
 
spawn-fcgi 设置
注册并启动spawn-fcgi和php-fpm服务。
服务注册和启动
 
在防火墙上打一个洞。
开放端口
 
请注意,php-fpm 可以按原样使用,使用安装包时的默认配置文件。

内容文件

为每个脚本创建一个索引。
index.html
 

对于 PHP

脚本文件
/usr/share/nginx/html/php.php
 
操作确认
 

对于 Perl

脚本文件
/usr/share/nginx/html/perl.pl
 
操作确认
 

对于Python

脚本文件
/usr/share/nginx/html/python.py
 
操作确认

对于Ruby

脚本文件
/usr/share/nginx/html/ruby.rb
 
操作确认
 

从浏览器检查

index.html php.php python.py perl.pl ruby.rb
notion image
notion image
notion image
notion image
notion image
 
notion image
玩客云root后可以玩些啥免费cachefly cdn使用方法
Loading...