设为首页 加入收藏

TOP

三台虚拟主机搭建lnmp(三)
2023-07-23 13:35:48 】 浏览:92
Tags:台虚拟 lnmp
lt koi-win mime.types.default nginx.conf.default scgi_params.default uwsgi_params.default [root@nginx conf]# vim nginx.conf location / { root html; index index.php index.html index.htm ; //添加index.php } 取消下面的注释并进行修改: #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} 修改: location ~ \.php$ { root html; //指向php端index.php文件位置 fastcgi_pass 192.168.222.139:9000; //监听php端的9000端口 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name; // 将/scripts更改为/usr/local/nginx/html include fastcgi_params; [root@nginx conf]# cd [root@nginx ~]# vim /usr/local/nginx/html/index.php //编写php测试页面 [root@nginx ~]# cat /usr/local/nginx/html/index.php <?php phpinfo(); ?> [root@nginx nginx]# systemctl restart nginx.service //重启服务

配置php

[root@php ~]# cd /usr/local/php8/etc/php-fpm.d/
[root@php php-fpm.d]# ls
www.conf  www.conf.default
[root@php php-fpm.d]# vim www.conf
listen = 192.168.222.139:9000    //php主机ip
listen.allowed_clients = 192.168.222.137   //允许ip访问(nginx主机ip)
[root@php php-fpm.d]# cd
[root@php ~]# cat > /usr/local/nginx/html/index.php << EOF 
//编写php端网站
> <?php
>     phpinfo();
> ?>
> EOF
[root@php ~]# systemctl restart php-fpm.service  //重启服务
[root@php ~]# ss -antl   //查看端口
State      Recv-Q     Send-Q           Local Address:Port          Peer Address:Port     Process     
LISTEN     0          128                    0.0.0.0:22                 0.0.0.0:*                    
LISTEN     0          128            192.168.222.139:9000               0.0.0.0:*                    
LISTEN     0          128                       [::]:22                    [::]:*                    

访问:
这里是使用你在刚刚配置里面允许的主机ip进行访问,一般是允许nginx这台主机的ip进行访问

首页 上一页 1 2 3 4 5 6 下一页 尾页 3/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇VMware vSphere 8.0 正式版下载 下一篇DNS域名解析服务

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目