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

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


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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值