腾讯云服务器购买后怎么安装php环境

如题所述

    配置nginx

    1) 启动nginx服务:

    service nginx restart

    2) 测试nginx服务是否正常运行:

    wget http://127.0.0.1
    最后显示" 'index.html' saved ",说明nginx服务正常。

    3)在浏览器中,访问通过CentOS云服务器公网IP查看nginx服务是否正常运行

    配置PHP

    1) 启动php-fpm:

    service php-fpm start

    2) 修改php-fpm和nginx的配置,实现nginx和php联动:

    cat /etc/php-fpm.d/www.conf |grep -i 'listen ='

    返回结果为:listen = 127.0.0.1:9000

    以上结果表明php-fpm的默认配置的监听端口为9000,现在只用修改配置,将php解       析的请求转发到127.0.0.0:9000处理即可。

    使用以下命令查找nginx配置文件:

    nginx -t

    并使用vi命令修改该配置文件

    在配置文件中找到以下片段,修改粗体部分

    server {  

    listen       80;
    root   /usr/share/nginx/html;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
    index  index.html index.htm;
    }

    #error_page  404              /404.html;
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
    root   /usr/share/nginx/html;
    }
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #  

    location ~ .php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index   index.php;
    fastcgi_param  SCRIPT_FILENAME                        $document_root$fastcgi_script_name;
    include        fastcgi_params;
    }

    }

    重启服务:service nginx restart

    环境配置验证

    vim /usr/share/nginx/html/index.php
    写入:<?phpecho "<title>Test Page</title>";echo "hello world";?>

    在浏览器中,访问CentOS云服务器公网IP查看环境配置是否成功,如果页面可以显示“hello world”,说明配置成功。

    mysql自己安装

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-11-06
小鸟云服务器niaoyun实例创建好之后,您可以使用以下任意一种方式登录服务器:

远程桌面连接(MicrosoftTerminalServicesClient,MSTSC):采用这种方式登录,请确保实例能访问公网。如果在创建实例时没有购买带宽,则不能使用远程桌面连接。

管理终端VNC:无论您在创建实例时是否购买了带宽,只要您本地有网页浏览器,都可以通过管理控制台的管理终端登录实例。

使用远程桌面连接(MSTSC)登录实例

打开开始菜单>远程桌面连接,或在开始菜单>搜索中输入mstsc。也可以使用快捷键Win+R来启动运行窗口,输入mstsc后回车启动远程桌面连接。

在远程桌面连接对话框中,输入实例的公网IP地址。单击显示选项。

输入用户名,如小鸟云默认为niaoyun。单击允许我保存凭据,然后单击连接。这样以后登录就不需要手动输入密码了。
第2个回答  2017-11-06
安装护卫神.主机大师,可以一键安装IIS+PHP+MYSQL+FTP
相似回答