一台 nginx 一台php
nginx 配置 文件更改:
location ~ \.php$ {
root /opt/php;
fastcgi_pass 1.1.1.129:9000; #php服务器ip地址
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /opt/php$fastcgi_script_name;
include fastcgi_params;
}
php配置文件更改:
listen = 1.1.1.129:9000
listen.allowed_clients = 1.1.1.130,127.0.0.1
user = nginx
group = nginx
创建php页面文件目录,根据nginx 配置文件中的路径创建:
mkdir /opt/php
chown -R nginx:nginx /opt/php
在php目录下写入php文件
浏览器访问方式 http://nginx_ip/name.php
时间: 2024-10-19 16:14:26