nginx php 分離 文檔

一臺 nginx  一臺phpphp

nginx 配置 文件更改:nginx

       location ~ \.php$ {瀏覽器

        root  /opt/php;服務器

        fastcgi_pass   1.1.1.129:9000;     #php服務器ip地址ide

        fastcgi_index  index.php;spa

        fastcgi_param  SCRIPT_FILENAME  /opt/php$fastcgi_script_name;ip

        include        fastcgi_params;get

    }it

php配置文件更改:io

  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

相關文章
相關標籤/搜索