I need to uncomment the existing text inside the default file
the file in this site is very similar to my default file
https://salsa.debian.org/nginx-team/nginx/blob/master/debian/conf/sites-available/default
the differance is that because i use https certificate I have in the default file another section of server{} and inside of it i have another occurrence of this next part... so I need to find in the first server{} section and add info.php to the line with the arrow I've created for demonstrating in which line i want to add info.php
server {
# Add index.php to the list if you are using PHP
--> index index.html index.htm index.nginx-debian.html;
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
#include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
#fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
# # With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
#include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#deny all;
#}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen someport;
# listen [::]:someport;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
}
and then search at the next server{} section and in this part I need to change this:
server {
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name mydomainname.com; # managed by Certbot
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
#include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
#fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
# # With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
#include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#deny all;
#}
listen [::]:someport ssl ipv6only=on; # managed by Certbot
listen someport ssl; # managed by Certbot
}
to this:
server {
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name mydomainname.com; # managed by Certbot
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
# # With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
listen [::]:someport ssl ipv6only=on; # managed by Certbot
listen someport ssl; # managed by Certbot
}
I've already tried sed but i'm not so good in the syntax of it because i get all kind of errors about the special characters in it can some one help me with this one?