diff --git a/web-framework/php/discuz/publish.yaml b/web-framework/php/discuz/publish.yaml index f0ae9f5f7..97436dcbe 100755 --- a/web-framework/php/discuz/publish.yaml +++ b/web-framework/php/discuz/publish.yaml @@ -2,7 +2,7 @@ Type: Application Name: start-discuz Provider: - 阿里云 -Version: 1.2.5 +Version: 1.2.6 Description: Crossday Discuz! Board(简称 Discuz!)是一套通用的社区论坛软件系统 HomePage: https://github.com/devsapp/start-web-framework Tags: diff --git a/web-framework/php/discuz/src/code/nginx.conf b/web-framework/php/discuz/src/code/nginx.conf new file mode 100644 index 000000000..9c1feda69 --- /dev/null +++ b/web-framework/php/discuz/src/code/nginx.conf @@ -0,0 +1,75 @@ +error_log /tmp/log/nginx/error.log error; +worker_processes auto; +pid /tmp/nginx.pid; + +events { + worker_connections 768; +} + +http { + client_body_temp_path /tmp/var/nginx/body; + fastcgi_temp_path /tmp/var/nginx/fastcgi; + proxy_temp_path /tmp/var/nginx/proxy; + uwsgi_temp_path /tmp/var/nginx/uwsgi; + scgi_temp_path /tmp/var/nginx/scgi; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 1200; + types_hash_max_size 2048; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; + + access_log /dev/stdout; + error_log /dev/stderr error; + + gzip on; + gzip_disable "msie6"; + + server { + listen 9000; + server_name localhost; + root /mnt/auto/discuz; + + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Content-Type-Options "nosniff"; + + index index.html index.htm index.php; + + charset utf-8; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + error_page 404 /index.php; + + location ~ \.php$ { + fastcgi_pass 127.0.0.1:9527; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + include /etc/nginx/fastcgi_params; + proxy_read_timeout 180; + } + + location ~.*\.(js|css|html|png|jpg|jpeg|gif|gz|svg|mp4|ogg|ogv|webm|htc|xml|woff)$ + { + expires 1d; + access_log off; + try_files $uri =404; + } + + location ~ /\.(?!well-known).* { + deny all; + } + } +} diff --git a/web-framework/php/discuz/src/code/php-fpm.conf b/web-framework/php/discuz/src/code/php-fpm.conf new file mode 100644 index 000000000..2ca06859d --- /dev/null +++ b/web-framework/php/discuz/src/code/php-fpm.conf @@ -0,0 +1,15 @@ +[global] +pid = /tmp/php7.4-fpm.pid +error_log = /tmp/php7.4-fpm.log + +[www] +user = www-data +group = www-data +listen = 127.0.0.1:9527 +listen.owner = www-data +listen.group = www-data +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 \ No newline at end of file diff --git a/web-framework/php/discuz/src/code/php.ini b/web-framework/php/discuz/src/code/php.ini new file mode 100644 index 000000000..d5eb0b4ed --- /dev/null +++ b/web-framework/php/discuz/src/code/php.ini @@ -0,0 +1,197 @@ +[PHP] +engine = On +short_open_tag = Off +precision = 14 +output_buffering = 4096 +zlib.output_compression = Off +implicit_flush = Off +unserialize_callback_func = +serialize_precision = -1 +disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, +disable_classes = +zend.enable_gc = On +expose_php = Off +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 +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" +doc_root = +user_dir = +enable_dl = Off +file_uploads = On +upload_max_filesize = 2M +max_file_uploads = 20 +allow_url_fopen = On +allow_url_include = Off +default_socket_timeout = 60 + +[CLI Server] +cli_server.color = On + +[Pdo_mysql] +pdo_mysql.cache_size = 2000 +pdo_mysql.default_socket= + +[mail function] +SMTP = localhost +smtp_port = 25 +mail.add_x_header = 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_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 + +[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 + +[Session] +session.save_handler = files +session.save_path=/mnt/auto/sessions +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 = 0 +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.sid_length = 26 +session.trans_sid_tags = "a=href,area=href,frame=src,form=" +session.sid_bits_per_character = 5 +[Assertion] +zend.assertions = -1 +[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 + +[ldap] +ldap.max_links = -1 + +extension_dir=/usr/lib/php/20190902/ +extension=bcmath.so +extension=ctype.so +extension=ffi.so +extension=gettext.so +extension=intl.so +extension=mcrypt.so +extension=opcache.so +extension=pdo_sqlite.so +extension=protobuf.so +extension=simplexml.so +extension=swoole.so +extension=tokenizer.so +extension=xmlwriter.so +extension=build +extension=curl.so +extension=fileinfo.so +extension=iconv.so +extension=json.so +extension=memcached.so +extension=pdo.so +extension=pgsql.so +extension=readline.so +extension=soap.so +extension=sysvmsg.so +extension=xml.so +extension=xsl.so +extension=bz2.so +extension=dom.so +extension=ftp.so +extension=imagick.so +extension=ldap.so +extension=mysqli.so +extension=pdo_mysql.so +extension=phar.so +extension=redis.so +extension=sockets.so +extension=sysvsem.so +extension=xmlreader.so +extension=zip.so +extension=calendar.so +extension=exif.so +extension=gd.so +extension=imap.so +extension=mbstring.so +extension=mysqlnd.so +extension=pdo_pgsql.so +extension=posix.so +extension=shmop.so +extension=sqlite3.so +extension=sysvshm.so +extension=xmlrpc.so + +[opcache] +zend_extension=opcache.so +opcache.enable=1 +opcache.memory_consumption=256 +opcache.interned_strings_buffer=64 +opcache.max_accelerated_files=32531 +opcache.save_comments=1 +opcache.fast_shutdown=0 \ No newline at end of file diff --git a/web-framework/php/discuz/src/code/start.sh b/web-framework/php/discuz/src/code/start.sh index 9c1feda69..d2594f14e 100755 --- a/web-framework/php/discuz/src/code/start.sh +++ b/web-framework/php/discuz/src/code/start.sh @@ -1,75 +1,32 @@ -error_log /tmp/log/nginx/error.log error; -worker_processes auto; -pid /tmp/nginx.pid; - -events { - worker_connections 768; -} - -http { - client_body_temp_path /tmp/var/nginx/body; - fastcgi_temp_path /tmp/var/nginx/fastcgi; - proxy_temp_path /tmp/var/nginx/proxy; - uwsgi_temp_path /tmp/var/nginx/uwsgi; - scgi_temp_path /tmp/var/nginx/scgi; - - sendfile on; - tcp_nopush on; - tcp_nodelay on; - keepalive_timeout 1200; - types_hash_max_size 2048; - - include /etc/nginx/mime.types; - default_type application/octet-stream; - - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE - ssl_prefer_server_ciphers on; - - access_log /dev/stdout; - error_log /dev/stderr error; - - gzip on; - gzip_disable "msie6"; - - server { - listen 9000; - server_name localhost; - root /mnt/auto/discuz; - - add_header X-Frame-Options "SAMEORIGIN"; - add_header X-XSS-Protection "1; mode=block"; - add_header X-Content-Type-Options "nosniff"; - - index index.html index.htm index.php; - - charset utf-8; - - location / { - try_files $uri $uri/ /index.php?$query_string; - } - - location = /favicon.ico { access_log off; log_not_found off; } - location = /robots.txt { access_log off; log_not_found off; } - - error_page 404 /index.php; - - location ~ \.php$ { - fastcgi_pass 127.0.0.1:9527; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; - include /etc/nginx/fastcgi_params; - proxy_read_timeout 180; - } - - location ~.*\.(js|css|html|png|jpg|jpeg|gif|gz|svg|mp4|ogg|ogv|webm|htc|xml|woff)$ - { - expires 1d; - access_log off; - try_files $uri =404; - } - - location ~ /\.(?!well-known).* { - deny all; - } - } -} +#!/usr/bin/env bash +set +e + +mkdir -p /tmp/log/nginx/ +mkdir -p /tmp/var/nginx/ +mkdir -p /tmp/var/sessions/ + +chown -R www-data:www-data /mnt/auto/discuz + +echo "start php-fpm" +php-fpm7.4 -c /code/php.ini -y /code/php-fpm.conf + +echo "start nginx" +nginx -c /code/nginx.conf + +sleep 5 + +while true +do + echo "check nginx and php-fpm process ...." + nginx_server=`ps aux | grep nginx | grep -v grep` + if [ ! "$nginx_server" ]; then + echo "restart nginx ..." + nginx -c /code/nginx.conf + fi + php_fpm_server=`ps aux | grep php-fpm | grep -v grep` + if [ ! "$php_fpm_server" ]; then + echo "restart php-fpm ..." + php-fpm7.4 -c /code/php.ini-production -y /code/php-fpm.conf + fi + sleep 10 +done \ No newline at end of file