ITeye博客

【转】【API管理系统showdoc部署】+【CentOS-5.10 YUM 方式安装NGINX+PHP】

leon1509 · 2016-03-01 17:49 · showdoc · 互联网 · Markdown

杂乱不堪的API文档,word、excel、pdf,迫切想找一款API管理工具,最终找到了showdoc(https://github.com/star7th/showdoc),基于php,对于我这个javaer来说略显困难。在一番折腾后终于搞定。

 

1、安装nginx

 

[html] view plain copy

 

  1. yum install nginx

 

2、安装php

 

[html] view plain copy

 

  1. yum remove httpd* php*
  2. yum install yum-priorities -y
  3. rpm -Uvh http://mirrors.opencas.cn/epel/epel-release-latest-5.noarch.rpm
  4. rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
  5. yum --enablerepo=remi install php php-fpm
  6. yum --enablerepo=remi install php-gd php-mysql php-mbstring php-xml php-mcrypt

3、配置nginx

 

 

[html] view plain copy

 

  1. vi /etc/nginx/nginx.conf

[html] view plain copy

 

  1. user  nginx;
  2. worker_processes  2;
  3. error_log  /var/log/nginx/error.log warn;
  4. pid        /var/run/nginx.pid;
  5. events {
  6. worker_connections  1024;
  7. }
  8. http {
  9. include       /etc/nginx/mime.types;
  10. default_type  application/octet-stream;
  11. log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  12. '$status $body_bytes_sent "$http_referer" '
  13. '"$http_user_agent" "$http_x_forwarded_for"';
  14. access_log  /var/log/nginx/access.log  main;
  15. sendfile        on;
  16. #tcp_nopush     on;
  17. keepalive_timeout  65;
  18. gzip on;
  19. gzip_http_version 1.0;
  20. gzip_disable "MSIE [1-6]\.(?!.*SV1)";
  21. gzip_min_length 1024;
  22. gzip_comp_level 3;
  23. gzip_types application/javascript text/css image/gif image/jpeg image/png;
  24. include /etc/nginx/conf.d/*.conf;
  25. server {
  26. listen 8000;
  27. server_name www.域名.com;
  28. root /mnt/www;
  29. index index.html index.htm index.shtml index.php;
  30. location / {
  31. if (!-e $request_filename) {
  32. rewrite ^(.*)$ /index.php?s=$1 last;
  33. break;
  34. }
  35. }
  36. location ~ .php {
  37. fastcgi_pass   127.0.0.1:9000;
  38. fastcgi_index  index.php;
  39. fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  40. include        fastcgi_params;
  41. set $path_info "";
  42. set $real_script_name $fastcgi_script_name;
  43. if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
  44. set $real_script_name $1;
  45. set $path_info $2;
  46. }
  47. fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
  48. fastcgi_param SCRIPT_NAME $real_script_name;
  49. fastcgi_param PATH_INFO $path_info;
  50. }
  51. location ~ /\.ht {
  52. deny all;
  53. }
  54. }
  55. }

4、配置php-fpm

 

 

[html] view plain copy

 

  1. vi /etc/php-fpm.d/www.conf

[html] view plain copy

 

  1. user = nginx
  2. group = nginx

5、配置php

 

 

[html] view plain copy

 

  1. chown -R nginx:nginx /var/lib/php/session

6、下载https://github.com/star7th/showdoc源码,上传到/mnt/www内

 

 

[html] view plain copy

 

  1. chmod 777 /mnt/www/showdoc-master/Application/Runtime/

 

 

7、启动php-fpm

 

[html] view plain copy

 

  1. /etc/init.d/php-fpm restart

8、启动nginx

 

 

[html] view plain copy

 

  1. /etc/init.d/nginx restart

 

 

9、访问 http://域名:8000/showdoc-master/

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。