在宝塔上部署了一个Nextcloud流程,再加个Nginx伪静态规则

  • A+
所属分类:AMH

PHP版本7.1,需要用到2个扩展,一个是memcached,按上面一样的方式在面板安装即可。另一个是APCu模块,这个模块需要手动安装。我们进入http://pecl.php.net/package/APCu 获取最新的APCu扩展链接丢进VPS。下面以5.1.9版本,APCu部署方法:
1.下载扩展解压并进入目录

wget http://pecl.php.net/get/apcu-5.1.9.tgz && tar xvf apcu-5.1.9.tgz && cd apcu-5.1.9

2.安装插件并修改PHP配置

/www/server/php/71/bin/phpize && ./configure --with-php-config=/www/server/php/71/bin/php-config && make && make install && echo "extension = apcu.so" >> /www/server/php/71/etc/php.ini

3.重启PHP并查看插件是否安装成功

/etc/init.d/php-fpm-71 reload && /www/server/php/71/bin/php -m

4.PHP的系统环境变量设置

vim /www/server/php/71/etc/php-fpm.conf
最后行加入
env[PATH] = /usr/local/bin:/usr/bin:/bin:/usr/local/php/bin

重启

service php-fpm-71 restart

下面,伪静态规则

    gzip off;
    add_header X-Content-Type-Options nosniff;
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Robots-Tag none;
    add_header X-Download-Options noopen;
    add_header X-Permitted-Cross-Domain-Policies none;
		location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
    rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
    location / {
    try_files $uri/ /index.php?/$uri;
    }
    location /admin.php { 
    try_files $uri $uri/ /admin.php;
    }
    location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
        deny all;
    }
    location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
        deny all;
    }
    location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param HTTPS on;
        fastcgi_param front_controller_active true;
      }
	location ~ ^/(?:updater|ocs-provider)(?:$|/) {
        try_files $uri/ =404;
        index index.php;
    }
    location ~ \.(?:css|js|woff|svg|gif)$ {
        try_files $uri /index.php$uri$is_args$args;
      }
    location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
        try_files $uri /index.php$uri$is_args$args;
      }	

在宝塔上部署了一个Nextcloud流程,再加个Nginx伪静态规则

weinxin
QQ群:20764411
QQ群扫码加群