Last active
July 5, 2021 12:31
-
-
Save jdwoody/7ca773e4b49adfee97cd9d712f4259d7 to your computer and use it in GitHub Desktop.
Nextcloud on SmartOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These scripts install nextcloud on Apache in a SmartOS Zone. | |
Replace the necessary values in nc.sql, httpd.conf, and smartos.json (look for [your... ]) | |
Use the json below to create the nextcloud zone: vmadm validate create -f smartos.json && vmadm create -f smartos.json | |
Place the install.sh, nc.sql, httpd.conf, and php.ini file into the nextcloud zone | |
This script assumes mysql is installed on another server/zone and the root user can login from this zone. You can modify the script | |
to install mysql server if needed. | |
Run ./install.sh | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ServerRoot "/opt/local" | |
Listen 0.0.0.0:80 | |
LoadModule authn_file_module lib/httpd/mod_authn_file.so | |
LoadModule authn_core_module lib/httpd/mod_authn_core.so | |
LoadModule authz_host_module lib/httpd/mod_authz_host.so | |
LoadModule authz_groupfile_module lib/httpd/mod_authz_groupfile.so | |
LoadModule authz_user_module lib/httpd/mod_authz_user.so | |
LoadModule authz_core_module lib/httpd/mod_authz_core.so | |
LoadModule access_compat_module lib/httpd/mod_access_compat.so | |
LoadModule auth_basic_module lib/httpd/mod_auth_basic.so | |
LoadModule reqtimeout_module lib/httpd/mod_reqtimeout.so | |
LoadModule filter_module lib/httpd/mod_filter.so | |
LoadModule mime_module lib/httpd/mod_mime.so | |
LoadModule log_config_module lib/httpd/mod_log_config.so | |
LoadModule env_module lib/httpd/mod_env.so | |
LoadModule headers_module lib/httpd/mod_headers.so | |
LoadModule setenvif_module lib/httpd/mod_setenvif.so | |
LoadModule version_module lib/httpd/mod_version.so | |
LoadModule mpm_prefork_module lib/httpd/mod_mpm_prefork.so | |
LoadModule unixd_module lib/httpd/mod_unixd.so | |
LoadModule status_module lib/httpd/mod_status.so | |
LoadModule autoindex_module lib/httpd/mod_autoindex.so | |
LoadModule dir_module lib/httpd/mod_dir.so | |
LoadModule alias_module lib/httpd/mod_alias.so | |
LoadModule rewrite_module lib/httpd/mod_rewrite.so | |
LoadModule php7_module lib/httpd/mod_php7.so | |
<IfModule unixd_module> | |
User www | |
Group www | |
</IfModule> | |
ServerAdmin [your serveradmin email] | |
<Directory /> | |
AllowOverride none | |
Require all denied | |
</Directory> | |
<IfModule dir_module> | |
DirectoryIndex index.html index.php | |
</IfModule> | |
<Files ".ht*"> | |
Require all denied | |
</Files> | |
ErrorLog "/var/log/httpd/error_log" | |
LogLevel warn | |
<IfModule log_config_module> | |
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined | |
LogFormat "%h %l %u %t \"%r\" %>s %b" common | |
<IfModule logio_module> | |
# You need to enable mod_logio.c to use %I and %O | |
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio | |
</IfModule> | |
CustomLog "/var/log/httpd/access_log" common | |
</IfModule> | |
<IfModule alias_module> | |
ScriptAlias /cgi-bin/ "/opt/local/libexec/cgi-bin/" | |
</IfModule> | |
<Directory "/opt/local/libexec/cgi-bin"> | |
AllowOverride None | |
Options None | |
Require all granted | |
</Directory> | |
<IfModule mime_module> | |
# | |
# TypesConfig points to the file containing the list of mappings from | |
# filename extension to MIME-type. | |
# | |
TypesConfig etc/httpd/mime.types | |
AddType application/x-compress .Z | |
AddType application/x-gzip .gz .tgz | |
</IfModule> | |
# Configure mod_proxy_html to understand HTML4/XHTML1 | |
<IfModule proxy_html_module> | |
Include etc/httpd/proxy-html.conf | |
</IfModule> | |
# Secure (SSL/TLS) connections | |
#Include etc/httpd/httpd-ssl.conf | |
# | |
# Note: The following must must be present to support | |
# starting without SSL on platforms with no /dev/random equivalent | |
# but a statically compiled-in mod_ssl. | |
# | |
<IfModule ssl_module> | |
SSLRandomSeed startup builtin | |
SSLRandomSeed connect builtin | |
</IfModule> | |
##NEXT CLOUD | |
<FilesMatch \.php$> | |
SetHandler application/x-httpd-php | |
</FilesMatch> | |
DocumentRoot "/opt/local/share/nextcloud" | |
<Directory /opt/local/share/nextcloud> | |
Options Indexes FollowSymLinks | |
AllowOverride All | |
<IfModule mod_dav.c> | |
Dav off | |
</IfModule> | |
SetEnv HOME /opt/local/share/nextcloud | |
SetEnv HTTP_HOME /opt/local/share/nextcloud | |
Require all granted | |
</Directory> | |
##NEXT CLOUD | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NC_INSTALL_DIR=/opt/local/share/nextcloud | |
# change/or remove @mysql as needed | |
MYSQL_USER="root" | |
MYSQL_HOST="mysql" | |
#https://download.nextcloud.com/server/releases/nextcloud-11.0.1.tar.bz2 | |
NC_ZIP_FILE="nextcloud-11.0.1.tar.bz2" | |
{ | |
echo "Updating available packages" | |
pkgin up | |
echo "Upgrading existing packages" | |
pkgin -y ug | |
echo "Installing packages" | |
pkgin -y in apache ap24-php70 php70-mysqli php70-pdo_mysql php70-pdo php70-curl php70-bz2 php70-json php70-zip php70-dom php70-mbstring php70-gd php70-zlib mysql-client php70-posix php70-iconv | |
#uncomment if you want to download the zip | |
wget https://download.nextcloud.com/server/releases/$NC_ZIP_FILE | |
#uncomment next 3 lines if you need mysql server installed | |
#pkgin -y in mysql-server | |
#echo "Enabling mysql" | |
#svcadm enable -r svc:/pkgsrc/mysql:default | |
echo "Unpacking NextCloud to $NC_INSTALL_DIR" | |
bunzip2 $NC_ZIP_FILE | |
tar -C /opt/local/share/ -x -f ${NC_ZIP_FILE/.bz2/} | |
echo "Configuring mysql for nextcloud" | |
mysql -u $MYSQL_USER -h $MYSQL_HOST -p < nc.sql | |
echo "Backing up httpd.conf and php.ini" | |
mv /opt/local/etc/httpd/httpd.conf /opt/local/etc/httpd/httpd.orig | |
mv /opt/local/etc/php.ini /opt/local/etc/php.orig | |
echo "Installing httpd.conf for nextcloud" | |
cp httpd.conf /opt/local/etc/httpd/httpd.conf | |
echo "Install php.ini for nextcloud" | |
cp php.ini /opt/local/etc/php.ini | |
echo "Setting owner of Nextcloud files to www user" | |
chown -R www $NC_INSTALL_DIR/* | |
echo "Enabling Apache httpd" | |
svcadm disable svc:/pkgsrc/apache && svcadm enable svc:/pkgsrc/apache && sleep 2 && svcs -a | grep apache | |
echo "Install Complete" | |
} | tee nextcloudinstall.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE IF NOT EXISTS nextcloud; | |
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nc_admin'@'[your host name]' identified by '[your password]'; | |
flush privileges; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[PHP] | |
engine = On | |
short_open_tag = Off | |
precision = 14 | |
output_buffering = 4096 | |
zlib.output_compression = Off | |
implicit_flush = Off | |
unserialize_callback_func = | |
serialize_precision = 17 | |
disable_functions = | |
disable_classes = | |
zend.enable_gc = On | |
expose_php = On | |
max_execution_time = 30 | |
max_input_time = 60 | |
memory_limit = 128M | |
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT | |
display_errors = Off | |
display_startup_errors = Off | |
log_errors = On | |
log_errors_max_len = 1024 | |
ignore_repeated_errors = Off | |
ignore_repeated_source = Off | |
report_memleaks = On | |
track_errors = Off | |
html_errors = On | |
variables_order = "GPCS" | |
request_order = "GP" | |
register_argc_argv = Off | |
auto_globals_jit = On | |
post_max_size = 8M | |
auto_prepend_file = | |
auto_append_file = | |
default_mimetype = "text/html" | |
default_charset = "UTF-8" | |
include_path = ".:/opt/local/lib/php" | |
doc_root = | |
user_dir = | |
enable_dl = Off | |
file_uploads = On | |
upload_tmp_dir = /tmp | |
upload_max_filesize = 2M | |
max_file_uploads = 20 | |
allow_url_fopen = On | |
allow_url_include = Off | |
default_socket_timeout = 60 | |
extension=curl.so | |
extension=dom.so | |
extension=gd.so | |
extension=iconv.so | |
extension=json.so | |
extension=mbstring.so | |
extension=zip.so | |
extension=zlib.so | |
extension=posix.so | |
extension=pdo.so | |
extension=pdo_mysql.so ;if you select MySQL backend. | |
[CLI Server] | |
cli_server.color = On | |
[Date] | |
[filter] | |
[iconv] | |
[intl] | |
[sqlite3] | |
[Pcre] | |
[Pdo] | |
[Pdo_mysql] | |
pdo_mysql.cache_size = 2000 | |
pdo_mysql.default_socket= | |
[Phar] | |
[mail function] | |
SMTP = localhost | |
smtp_port = 25 | |
mail.add_x_header = On | |
[SQL] | |
sql.safe_mode = Off | |
[ODBC] | |
odbc.allow_persistent = On | |
odbc.check_persistent = On | |
odbc.max_persistent = -1 | |
odbc.max_links = -1 | |
odbc.defaultlrl = 4096 | |
odbc.defaultbinmode = 1 | |
[Interbase] | |
ibase.allow_persistent = 1 | |
ibase.max_persistent = -1 | |
ibase.max_links = -1 | |
ibase.timestampformat = "%Y-%m-%d %H:%M:%S" | |
ibase.dateformat = "%Y-%m-%d" | |
ibase.timeformat = "%H:%M:%S" | |
[MySQLi] | |
mysqli.max_persistent = -1 | |
mysqli.allow_local_infile = On | |
mysqli.allow_persistent = On | |
mysqli.max_links = -1 | |
mysqli.cache_size = 2000 | |
mysqli.default_port = 3306 | |
mysqli.default_socket = | |
mysqli.default_host = | |
mysqli.default_user = | |
mysqli.default_pw = | |
mysqli.reconnect = Off | |
[mysqlnd] | |
mysqlnd.collect_statistics = On | |
mysqlnd.collect_memory_statistics = Off | |
[OCI8] | |
[PostgreSQL] | |
pgsql.allow_persistent = On | |
pgsql.auto_reset_persistent = Off | |
pgsql.max_persistent = -1 | |
pgsql.max_links = -1 | |
pgsql.ignore_notice = 0 | |
pgsql.log_notice = 0 | |
[bcmath] | |
bcmath.scale = 0 | |
[browscap] | |
[Session] | |
session.save_handler = files | |
session.use_strict_mode = 0 | |
session.use_cookies = 1 | |
session.use_only_cookies = 1 | |
session.name = PHPSESSID | |
session.auto_start = 0 | |
session.cookie_lifetime = 0 | |
session.cookie_path = / | |
session.cookie_domain = | |
session.cookie_httponly = | |
session.serialize_handler = php | |
session.gc_probability = 1 | |
session.gc_divisor = 1000 | |
session.gc_maxlifetime = 1440 | |
session.referer_check = | |
session.cache_limiter = nocache | |
session.cache_expire = 180 | |
session.use_trans_sid = 0 | |
session.hash_function = 0 | |
session.hash_bits_per_character = 5 | |
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" | |
[Assertion] | |
zend.assertions = -1 | |
[COM] | |
[mbstring] | |
[gd] | |
[exif] | |
[Tidy] | |
tidy.clean_output = Off | |
[soap] | |
soap.wsdl_cache_enabled=1 | |
soap.wsdl_cache_dir="/tmp" | |
soap.wsdl_cache_ttl=86400 | |
soap.wsdl_cache_limit = 5 | |
[sysvshm] | |
[ldap] | |
ldap.max_links = -1 | |
[mcrypt] | |
[dba] | |
[opcache] | |
[curl] | |
[openssl] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"brand": "joyent", | |
"image_uuid": "163cd9fe-0c90-11e6-bd05-afd50e5961b6", | |
"autoboot": true, | |
"alias": "nextcloud", | |
"hostname": "nextcloud", | |
"resolvers": [ | |
"[your dns]" | |
], | |
"max_physical_memory": 1024, | |
"max_swap": 1024, | |
"nics": [ | |
{ | |
"nic_tag": "[your nic tag]", | |
"mac": "[your mac addr]", | |
"ip": "dhcp" | |
} | |
], | |
"filesystems": [ | |
{ | |
"type": "lofs", | |
"source": "[your host volume]", | |
"target": "/data" | |
} | |
], | |
"customer_metadata": { | |
"root_authorized_keys": "[your ssh key here]" | |
}, | |
"internal_metadata": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment