Skip to content

Commit

Permalink
feat: support custom internal port for webserver
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Ribeiro committed Feb 22, 2025
1 parent 26b8ba5 commit c7bf346
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ RUN dos2unix /etc/cron.d/cronjobs && \
echo 'pm.max_requests = 500' >> /usr/local/etc/php-fpm.d/zz-docker.conf

# Expose port 80 for Nginx
EXPOSE 80

ARG SOFTWARE_VERSION=1.20.0
ARG WALLOS_PORT=80
EXPOSE ${WALLOS_PORT}

# Start both PHP-FPM, Nginx
CMD ["sh", "-c", "/var/www/html/startup.sh"]
CMD ["sh", "-c", "export WALLOS_PORT=${WALLOS_PORT:-80} && /var/www/html/startup.sh"]
15 changes: 4 additions & 11 deletions endpoints/logos/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,11 @@
function extractImageUrlsFromPage($html)
{
$imageUrls = [];
$pattern = '/<img[^>]+src="([^">]+)"/i';
preg_match_all($pattern, $html, $matches);

$doc = new DOMDocument();
@$doc->loadHTML($html);

$imgTags = $doc->getElementsByTagName('img');
foreach ($imgTags as $imgTag) {
$src = $imgTag->getAttribute('src');
if (!strstr($imgTag->getAttribute('class'), "favicon") && !strstr($imgTag->getAttribute('class'), "logo")) {
if (filter_var($src, FILTER_VALIDATE_URL)) {
$imageUrls[] = $src;
}
}
if (isset($matches[1])) {
$imageUrls = $matches[1];
}

return $imageUrls;
Expand Down
2 changes: 1 addition & 1 deletion includes/version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php
$version = "v2.45.2";
$version = "v2.45.3";
?>
2 changes: 1 addition & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ http {
keepalive_timeout 65;

server {
listen 80;
listen ${WALLOS_PORT:-80};
server_name localhost;

location / {
Expand Down
2 changes: 1 addition & 1 deletion nginx.default.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server {
listen 80;
listen ${WALLOS_PORT:-80};
server_name your_domain_or_ip; # Change to your domain or IP

root /var/www/html; # Change to your web root directory
Expand Down
6 changes: 6 additions & 0 deletions startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ groupmod -o -g "$PGID" www-data
usermod -o -u "$PUID" www-data
chown -R www-data:www-data /var/www/html

envsubst '${WALLOS_PORT}' < /etc/nginx/http.d/default.conf > /etc/nginx/http.d/default.conf.tmp
mv /etc/nginx/http.d/default.conf.tmp /etc/nginx/http.d/default.conf

envsubst '${WALLOS_PORT}' < /etc/nginx/nginx.conf > /etc/nginx/nginx.conf.tmp
mv /etc/nginx/nginx.conf.tmp /etc/nginx/nginx.conf

# Start both PHP-FPM and Nginx
php-fpm & nginx -g 'daemon off;' & touch ~/startup.txt

Expand Down

0 comments on commit c7bf346

Please sign in to comment.