-
Notifications
You must be signed in to change notification settings - Fork 175
快速开始
cayman edited this page Aug 5, 2016
·
13 revisions
如/home/www/phprs-restful-master/
将接口请求指向到index.php
- Nginx
location /api{
rewrite ^(/.*)?$ /index.php;
}
完整的例子:
server {
listen 80 default_server;
server_name localhost;
root /home/www/phprs-restful-master/example/public;
index index.php index.html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location /api {
rewrite ^(/.*)?$ /index.php;
}
location ~ \.php$ {
root /home/www/phprs-restful-master/example/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
}
- Apache
DocumentRoot "/var/www/phprs-restful-master/example/public"
<Directory "/var/www/phprs-restful-master/example/public">
Options Includes ExecCGI FollowSymLinks
AllowOverride All
Require all granted
</Directory>
请求
响应
{"msg":"Hello World!"}
请求
响应
输出文档