-
Notifications
You must be signed in to change notification settings - Fork 175
Quick start
cayman edited this page Aug 5, 2016
·
9 revisions
For example: /home/www/phprs-restful-master
Route RESTful requests to index.php, for example:
Nginx
location /api {
rewrite ^(/.*)?$ /index.php;
}
Samples:
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>
Request
Response
{"msg":"Hello World!"}
Request
Response
Documents