(CENTOS7) Nextcloud-PHP7-Nginx-MariaDB-SSL
(CENTOS7) Nextcloud-PHP7-Nginx-MariaDB-SSL
1. yum update
2. yum install epel-release
3. yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
4. vi /etc/yum.repos.d/remi-php72.repo
- [remi-php72]
- enabled=1
5. yum install php-fpm php-cli php-devel php-gd php-mysqlnd php-pear php-xml php-mbstring php-
pdo php-json php-pecl-apcu-devel php-pecl-imagick-devel php-intl php-opcache php-zip
6. vi /etc/php.ini
- cgi.fix_pathinfo=1
- upload_max_filesize = 500M
- post_max_size = 500M
7. vi /etc/php-fpm.d/www.conf
- user = nginx
- group = nginx
- listen = 127.0.0.1:6000 ( Ubah Port sesuai keubutuhan )
- env[HOSTNAME] = $HOSTNAME
- env[PATH] = /usr/local/bin:/usr/bin:/bin
- env[TMP] = /tmp
- env[TMPDIR] = /tmp
- env[TEMP] = /tmp
8. systemctl start php-fpm ( akan terjadi error karena user/group nginx belum terinstall )
9. systemctl enable php-fpm
10. chown nginx:nginx -R /var/lib/php/session/
1. yum update
2. yum install epel-release
3. yum install nginx
4. systemctl start nginx
5. systemctl enable nginx
6. vi /etc/nginx/nginx.conf , hapus semua konfigurasi awalnya lalu copas conf dibawa taro di
nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/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"';
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;
index index.php index.html index.htm;
client_max_body_size 100M;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
}
7. cd /home
8. mkdir nextcloud
9. yum install wget unzip
10. wget https://download.nextcloud.com/server/releases/nextcloud-19.0.1.zip
11. unzip nextcloud-19.0.1.zip
12. chmod -R 775 /home/nextcloud/
13. chown -R namauser:nginx /home/nextcloud/
14. Selanjutnya membuat Virtual host untuk Nextcloud nya pada Nginx
15. cd /etc/nginx/conf.d
16. vi nextcloud.conf, copy text dibawah ini, dan save pada file nextcloud.conf
upstream php-handler {
server 127.0.0.1:9000;
}
server {
listen 80;
server_name 192.168.1.253;
# enforce https
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name 192.168.1.253;
ssl_certificate /etc/nginx/cert/nextcloud.crt;
ssl_certificate_key /etc/nginx/cert/nextcloud.key;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you're planning to use this app.
#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 = /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}
location / {
rewrite ^ /index.php$uri;
}
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/.+|core/templates/40[34])\.php(?:$|/) {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}
location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
try_files $uri /index.php$uri$is_args$args;
# Optional: Don't log access to other assets
access_log off;
}
}
1. mkdir -p /etc/nginx/cert/
2. openssl req -new -x509 -days 365 -nodes -out /etc/nginx/cert/nextcloud.crt -keyout
/etc/nginx/cert/nextcloud.key
3. chmod 700 /etc/nginx/cert
4. chmod 600 /etc/nginx/cert/*
5. Isi Data”nya sampai selesai
6. systemctl restart nginx
7. systemctl restart php-fpm
8. firewall-cmd –permanent –add-port=80/tcp
9. firewall-cmd –permanent –add-port=443/tcp
10. firewall-cmd –reload
11. Setelah itu buka browser dan buka alamat nextcloud kalian, isi data”nya dengan lengkap dan
benar