{"id":181,"date":"2024-06-07T09:28:30","date_gmt":"2024-06-07T07:28:30","guid":{"rendered":"https:\/\/stage.centrica.it\/?page_id=181"},"modified":"2024-06-07T09:52:34","modified_gmt":"2024-06-07T07:52:34","slug":"dns-e-nginx","status":"publish","type":"page","link":"https:\/\/stage.centrica.it\/index.php\/dns-e-nginx\/","title":{"rendered":"DNS ed Nginx"},"content":{"rendered":"\n<p>Se si volesse avere un sito web bisognerebbe comprarlo da dei provider che possano fare da hosting, ci\u00f2 ti da un dominio su internet con il tuo nome(david.it per  esempio) ed un IP assegnato ad esso, nessun&#8217;altro potr\u00e0 usare quel nome, questo sistema si chiama DNS(domain name system).<\/p>\n\n\n\n<p>Nginx \u00e8 un web server usato anche come reverse\u00a0proxy,\u00a0load balancer,\u00a0cache\u00a0HTTP e\u00a0proxy\u00a0di\u00a0posta elettronica.<\/p>\n\n\n\n<p>Io ho usato nginx per hostare delle pagine HTML sulla rete locale per farlo basta avviare nginx e configurare nel file di testo conf, da subito dentro si pu\u00f2 trovare il server di &#8220;default&#8221; sulla rete 80 scritta cos\u00ec:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n        listen       80;\n        server_name  localhost;\n\n        #charset koi8-r;\n\n        #access_log  logs\/host.access.log  main;\n\n        location \/ {\n            root   html;\n            index  index.html index.htm;\n        }\n\n        #error_page  404              \/404.html;\n\n        # redirect server error pages to the static page \/50x.html\n        #\n        error_page   500 502 503 504  \/50x.html;\n        location = \/50x.html {\n            root   html;\n        }\n\n        # proxy the PHP scripts to Apache listening on 127.0.0.1:80\n        #\n        #location ~ \\.php$ {\n        #    proxy_pass   http:\/\/127.0.0.1;\n        #}\n\n        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\n        #\n        #location ~ \\.php$ {\n        #    root           html;\n        #    fastcgi_pass   127.0.0.1:9000;\n        #    fastcgi_index  index.php;\n        #    fastcgi_param  SCRIPT_FILENAME  \/scripts$fastcgi_script_name;\n        #    include        fastcgi_params;\n        #}\n\n        # deny access to .htaccess files, if Apache's document root\n        # concurs with nginx's one\n        #\n        #location ~ \/\\.ht {\n        #    deny  all;\n        #}\n    }<\/code><\/pre>\n\n\n\n<p>Dentro si possono anche vedere commenti con esempi di cosa si pu\u00f2 aggiungere dentro, per aggiungerne un altro di server basta fare:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n        listen       \"port number a scelta\";\n        listen       somename:8080;\n        server_name  somename  alias  another.alias;\n\n        location \/ {\n            root   \"posizione del file\";\n            index  index.html index.htm;\n        }\n    }<\/code><\/pre>\n\n\n\n<p>Cos\u00ec facendo si \u00e8 aggiunta un altro server a cui per accederci considerando come port number 3000 del server basta scrivere il numero del ip della rete ed il port number in questo modo: 10.0.0.39\/3000<\/p>\n\n\n\n<div style=\"height:130px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Se si volesse avere un sito web bisognerebbe comprarlo da dei provider che possano fare da hosting, ci\u00f2 ti da un dominio su internet con il tuo nome(david.it per esempio) ed un IP assegnato ad esso, nessun&#8217;altro potr\u00e0 usare quel nome, questo sistema si chiama DNS(domain name system). Nginx \u00e8 un web server usato anche [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-181","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/stage.centrica.it\/index.php\/wp-json\/wp\/v2\/pages\/181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stage.centrica.it\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/stage.centrica.it\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/stage.centrica.it\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stage.centrica.it\/index.php\/wp-json\/wp\/v2\/comments?post=181"}],"version-history":[{"count":4,"href":"https:\/\/stage.centrica.it\/index.php\/wp-json\/wp\/v2\/pages\/181\/revisions"}],"predecessor-version":[{"id":191,"href":"https:\/\/stage.centrica.it\/index.php\/wp-json\/wp\/v2\/pages\/181\/revisions\/191"}],"wp:attachment":[{"href":"https:\/\/stage.centrica.it\/index.php\/wp-json\/wp\/v2\/media?parent=181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}