1. 程式人生 > >linux(centos) 上搭建showdoc 第三方文件協作平臺

linux(centos) 上搭建showdoc 第三方文件協作平臺

公司要在內部搭建api協議介面管理,嘗試了twiki,moinmoin,最後選定showdoc,下面是具體搭建過程

1使用 yum 安裝 Nginx:

yum install nginx
有可能遇到yum ngnix不可安裝的情況(原因:ngnix不在centos官方源,請更新資源)

將檔案epel-release-7-11.noarch.rpm上傳到linux伺服器,執行命令

rpm -ivh epel-release-7-11.noarch.rpm;

2修改 /etc/nginx/nginx.conf 檔案為如下內容:

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80;
        server_name  127.0.0.1;
        root         /var/www/html;
        index index.php index.html
        error_page  404              /404.html;
        location = /40x.html {
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
        }
        location ~ .php$ {
            root           /var/www/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
        location ~ /.ht {
            deny  all;
        }
    }
}
3啟動 Nginx 並設定為開機啟動:
service nginx start
chkconfig nginx on
4安裝 PHP
yum install php php-gd php-fpm php-mcrypt php-mbstring php-mysql php-pdo

啟動 php-fpm 並設定為開機啟動:

service php-fpm start	
chkconfig php-fpm on

5建立專案

下載安裝 Composer

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

執行命令設定 Composer 使用國內映象

composer config -g repo.packagist composer https://packagist.phpcomposer.com

執行命令建立專案:

cd /var/www/html/ && composer create-project  showdoc/showdoc
設定 showdoc 目錄寫許可權
chmod a+w showdoc/install
chmod a+w showdoc/Sqlite
chmod a+w showdoc/Sqlite/showdoc.db.php
chmod a+w showdoc/Public/Uploads/
chmod a+w showdoc/Application/Runtime
chmod a+w showdoc/server/Application/Runtime
chmod a+w showdoc/Application/Common/Conf/config.php
chmod a+w showdoc/Application/Home/Conf/config.php
yum 安裝httpd 
yum install httpd

啟動專案

service httpd start;
建立完畢,您現在可以通過瀏覽器訪問 http://ip或者網址/showdoc/install/ ,進行語言的選擇以後即可通過 http://ip或者網址/showdoc 檢視站點效果。