Skip to content

Commit

Permalink
robots management
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-ivona committed Apr 2, 2024
1 parent 5a930e2 commit f96701a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
17 changes: 13 additions & 4 deletions app/Containers/Nginx.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,14 @@ public function expose_internal_host(): self
}



/**
* @param DockerService $service
*
* @throws DuplicateServiceException
* @throws ContainerException
*/
public function setup(DockerService $service)
public function setup(DockerService $service): void
{

if (!empty($this->php_service)) {
Expand All @@ -164,12 +165,20 @@ public function publish_assets()
$this->publish_backend_not_found();
}

protected function publish_nginx_conf()
protected function publish_nginx_conf(): void
{
$this->disk()->put(self::PATH_NGINX_CONF, Storage::get(self::PATH_NGINX_CONF));
$template = Storage::get(self::PATH_NGINX_CONF);

$this->compile_template($template, [
'ROBOTS' => env('ENABLE_ROBOTS', true)
? ''
: 'add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive"'
]);

$this->disk()->put(self::PATH_NGINX_CONF, $template);
}

protected function publish_upstream_conf()
protected function publish_upstream_conf(): void
{
if (!empty($this->php_service)) {
$template = Storage::get(self::PATH_UPSTREAM_CONF);
Expand Down
3 changes: 3 additions & 0 deletions storage/app/env/Laravel
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ NGINX_PORT_SSL=443
#NGINX_CACHE_AGE=1y
#NGINX_CACHE_FILES="js|css|jpg|jpeg|png|gif|ico|swf|webp|svg"

#ENABLE_ROBOTS=false


#######################
# MySql #
#######################
Expand Down
2 changes: 2 additions & 0 deletions storage/app/env/PlainPhp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ NGINX_ROOT=/var/www
#NGINX_CACHE_AGE=1y
#NGINX_CACHE_FILES="js|css|jpg|jpeg|png|gif|ico|swf|webp|svg"

#ENABLE_ROBOTS=false

#######################
# MySql #
#######################
Expand Down
2 changes: 2 additions & 0 deletions storage/app/env/ReverseProxy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ RECIPE=ReverseProxy
NGINX_PORT=80
NGINX_PORT_SSL=443

#ENABLE_ROBOTS=false



#######################
Expand Down
2 changes: 2 additions & 0 deletions storage/app/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ http {
client_max_body_size 5G;
fastcgi_read_timeout 600;
proxy_read_timeout 600;

[ROBOTS]
}

0 comments on commit f96701a

Please sign in to comment.