Skip to content

Commit

Permalink
fix: Update Web Server Default Configs (#412)
Browse files Browse the repository at this point in the history
* update web_server configs

* expose nginx worker_process as a command-line parameter

* Update web-serving.md
  • Loading branch information
aansaarii authored Feb 24, 2023
1 parent 246c6f2 commit 8660987
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion benchmarks/web-serving/web_server/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,15 @@ elif [ $PROTOCOL == 'http' ]; then
cat /tmp/nginx_sites_avail_pt.append >> /etc/nginx/sites-available/default
fi

FPM_CHILDREN=${5:-80}
FPM_CHILDREN=${5:-4}
WORKER_PROCESS=${6:-"auto"}

sed -i -e"s/pm.max_children = 5/pm.max_children = ${FPM_CHILDREN}/" /etc/php/${VERSION}/fpm/pool.d/www.conf
sed -i -e"s/pm = dynamic/pm = static/" /etc/php/${VERSION}/fpm/pool.d/www.conf


sed -i -e"s/worker_processes auto;/worker_processes ${WORKER_PROCESS};/" /etc/nginx/nginx.conf
sed -i -e's/;opcache.file_cache=/opcache.file_cache=\/tmp/' /etc/php/${VERSION}/fpm/php.ini

service php${VERSION}-fpm restart

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/web-serving/web_server/files/settings_4.3.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
* and CSS files. If you uncomment and configure these settings, you will not be able
* to change them from the Elgg advanced settings page.
*/
//$CONFIG->simplecache_enabled = true;
$CONFIG->simplecache_enabled = true;

/**
* Configure the boot cache TTL
Expand Down
4 changes: 2 additions & 2 deletions docs/benchmarks/web-serving.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ To start the web server, you first have to `pull` the server image by running th

To run the web server, use the following command:

$ docker run -dt --net=host --name=web_server cloudsuite/web-serving:web_server /etc/bootstrap.sh ${PROTOCOL} ${WEB_SERVER_IP} ${DATABASE_SERVER_IP} ${MEMCACHED_SERVER_IP} ${MAX_PM_CHILDREN}
$ docker run -dt --net=host --name=web_server cloudsuite/web-serving:web_server /etc/bootstrap.sh ${PROTOCOL} ${WEB_SERVER_IP} ${DATABASE_SERVER_IP} ${MEMCACHED_SERVER_IP} ${MAX_PM_CHILDREN} ${WORKER_PROCESS}

The `PROTOCOL` parameter can either be `http` or `https` and determines the web server's protocol. The `WEB_SERVER_IP`, `DATABASE_SERVER_IP`, and `MEMCACHED_SERVER_IP` parameters refer to the explicit IP of the server running each server. The `MAX_PM_CHILDREN` sets the pm.max_children in the php-fpm setting. The default value is 80.
The `PROTOCOL` parameter can either be `http` or `https` and determines the web server's protocol. The `WEB_SERVER_IP`, `DATABASE_SERVER_IP`, and `MEMCACHED_SERVER_IP` parameters refer to the explicit IP of the server running each server. The `MAX_PM_CHILDREN` sets the pm.max_children in the php-fpm setting. The default value is 4 and we recommend considering 4 per core. `WORKER_PROCESS` sets the number of Nginx worker processes. The default is `auto`. We recommend to have 1 Nginx worker process per 32 cores.

To check whether the web server is up, you can access Elgg's home page through a web browser by `http://<web_server's IP>:8080` or `https://<web_server's IP>:8443` URLs for HTTP and HTTPS web servers, respectively. For example, Elgg's home page is shown in the figure below:

Expand Down

0 comments on commit 8660987

Please sign in to comment.