Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 服务器安装thinkphp 主机宝 nginx伪静态

服务器安装thinkphp 主机宝 nginx伪静态

Jun 23, 2016 pm 01:39 PM

在阿里云的服务器安装thinkphp,服务器系统是linux,nginx,
我用wamp5本地环境已经正常访问,但是安装到服务器总是404,问了别人好像说是伪静态的问题,
研究了2天,实在不行了,
这个事我的目录结构

index.php代码

define ('SITE_URL','http://www.mydemo.com/demo4/');define('CSS_URL',SITE_URL.'public/Home/css/');define('IMG_URL',SITE_URL.'public/Home/images/');define('JS_URL',SITE_URL.'public/Home/js/');define('ADMIN_CSS_URL',SITE_URL.'public/admin/css/');define('ADMIN_IMG_URL',SITE_URL.'public/admin/images/');define('ADMIN_JS_URL',SITE_URL.'public/admin/js/');define('ADMIN_UPLOAD_URL',SITE_URL.'public/');// 检测PHP环境if(version_compare(PHP_VERSION,'5.3.0','<'))  die('require PHP > 5.3.0 !');// 开启调试模式 建议开发阶段开启 部署阶段注释或者设为falsedefine('APP_DEBUG',True);// 引入ThinkPHP入口文件require './ThinkPHP/ThinkPHP.php';// 亲^_^ 后面不需要任何代码了 就是如此简单
Copy after login


回复讨论(解决方案)

不是php程序的问题,nginx对pathinfo支持不好
配置参考:
location / {
    if (!-e $request_filename) {
        rewrite ^(.*)$ /index.php?s=$1 last;
        break;
    }
}

不是php程序的问题,nginx对pathinfo支持不好
配置参考:
location / {
    if (!-e $request_filename) {
        rewrite ^(.*)$ /index.php?s=$1 last;
        break;
    }
}


这要写在哪里,我用的主机宝,
早知道用windows 好了,

nginx 的域名配置文件。
暂时没发现nginx 有啥不好的 哈哈哈 用了 WINDOWS 你就知道真的不好了 


不是php程序的问题,nginx对pathinfo支持不好
配置参考:
location / {
    if (!-e $request_filename) {
        rewrite ^(.*)$ /index.php?s=$1 last;
        break;
    }
}


这要写在哪里,我用的主机宝,
早知道用windows 好了,

nginx/conf/vhosts/xxx.conf中
或者直接是nginx/conf/nginx.conf

nginx 的域名配置文件。
暂时没发现nginx 有啥不好的 哈哈哈 用了 WINDOWS 你就知道真的不好了 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

11 Best PHP URL Shortener Scripts (Free and Premium) 11 Best PHP URL Shortener Scripts (Free and Premium) Mar 03, 2025 am 10:49 AM

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Working with Flash Session Data in Laravel

Introduction to the Instagram API Introduction to the Instagram API Mar 02, 2025 am 09:32 AM

Introduction to the Instagram API

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Simplified HTTP Response Mocking in Laravel Tests

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

Build a React App With a Laravel Back End: Part 2, React

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

12 Best PHP Chat Scripts on CodeCanyon

Notifications in Laravel Notifications in Laravel Mar 04, 2025 am 09:22 AM

Notifications in Laravel

See all articles