您的位置:首页 > 运维架构 > Linux

centos下安装架设thinkphp3.2.3(windows去访问局域网中的centos中的站点)

2015-12-24 17:27 459 查看
说明

本地windows系统访问局域网中的centos系统中的站点

centos系统IP地址:192.168.0.10

web服务器:nginx

web根目录:/www/

nginx安装目录:/usr/local/nginx/

项目名称:lx

本地使用虚拟域名:www.lx.cx

搭建过程

将下载下来的压缩包 thinkphp_3.2.3_full.zip 解压出来

将解压出来的 thinkphp_3.2.3_full 文件夹改名成
lx 传到 /www/ 下面

在本地windows中的 C:\Windows\System32\drivers\etc\hosts 中加入
192.168.0.10       www.lx.cx

在 /usr/local/nginx/conf/vhost/ 中新建
lx.conf 加入以下代码 (vhost是做了配置扩展的文件夹,默认是写在
/usr/local/nginx/conf/nginx.conf中)
server

    {

        listen 80;

        #listen [::]:80 default_server ipv6only=on;

        server_name www.lx.cx;

        index index.html index.htm index.php;

        root /data0/www/lx/;

        location ~ \.php

        {

          try_files $uri =404;

          fastcgi_pass  unix:/tmp/php-cgi.sock;

          fastcgi_index index.php;

          include fastcgi.conf;

          set $path_info "";

          set $real_script_name $fastcgi_script_name;

          if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {

           set $real_script_name $1;

           set $path_info $2;

          }

          fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;

          fastcgi_param SCRIPT_NAME $real_script_name;

          fastcgi_param PATH_INFO $path_info;

        }

        #error_page   404   /404.html;

        include enable-php.conf;

        location /nginx_status

        {

            stub_status on;

            access_log   off;

        }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

        {

            expires      30d;

        }

        location ~ .*\.(js|css)?$

        {

            expires      12h;

        }

        location ~ /\.

        {

            deny all;

        }

        access_log  /home/wwwlogs/lx_access.log  access;

    }

重启 nginx
(# /usr/local/nginx/sbin/nginx -s reload)

在浏览器中输入网址 www.lx.cx 进行访问

出现 欢迎使用 ThinkPHP!表示搭建成功
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  centos linux thinkphp nginx