<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[מספר שרתי אינטרנט בשרת אחד]]></title><description><![CDATA[<p dir="auto">בשרת שלי (LAMP) לפורט 80 ו 443 מאזין שרת אפאצ'י.<br />
ומאידך אני משתמש בשרת זה גם בNGINX וגם ב NODEJS.<br />
עד היום השתמשתי בפורטים אחרים על מנת לגשת לשרתים האחרים.<br />
אני מעדיף להימנע מצורת העבודה הזו, זה גורם בעיות לגישה בחלק מחברות הסינון ועוד.<br />
לכאורה יש שתי אפשרויות:<br />
א. לשנות את הLAMP ל LNMP ואז אוכל לבצע הפניות לפורטים השונים (שיהיו פתוחים בשרת אבל חסומים בחומת האש) לפי הURL.<br />
ב. להוסיף תתי דומיין שהאזנה אליהם תיהיה ע"י NGINX, ואז שוב אהיה פתוח לחבר אותם לNODE ולאן שצריך.<br />
מה הכי קל, ומה הכי מומלץ?<br />
אציין שהרישום של הדומיין הוא ב AWS.</p>
]]></description><link>https://tchumim.com/topic/6121/מספר-שרתי-אינטרנט-בשרת-אחד</link><generator>RSS for Node</generator><lastBuildDate>Mon, 20 Jul 2026 03:44:48 GMT</lastBuildDate><atom:link href="https://tchumim.com/topic/6121.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 03 Aug 2019 20:20:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to מספר שרתי אינטרנט בשרת אחד on Mon, 05 Aug 2019 11:00:31 GMT]]></title><description><![CDATA[<p dir="auto">ב"ה הסתדרתי עם הכל, כולל עצירת האפאצ'י ומעבר הכל לnginx.<br />
להלן ההגדרות המלאות למי שזה יכול לעזור</p>
<pre><code># Implement upstream connection to PHP-FPM
# "phpfpm" here is a name for this upstream connection, which you can customize
# I create a custom upstream connection per vhost, to better segregate PHP processes by vhost
# To do the same, you need a unique upstream name, and a unique filename for your php5-fpm.sock file
upstream phpfpm {
    server unix:/var/run/php/php7.2-fpm.sock;
    #avoid sockets for nginx-fpm on Linux, they are good for BSD
    #server 127.0.0.1:9000;
}

server {
    # Listening on port 80 without an IP address is only recommended if you are not running multiple v-hosts
    # Bind to the public IP bound to your domain
    listen 80;
    listen 443 ssl;

    ssl_certificate /etc/letsencrypt/live/mydomainname.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mydomainname.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    # Specify this vhost's domain name
    server_name mydomainname.com;
    root /var/www/public_html;
    index index.php index.html index.htm;

    # Specify log locations for current site
    access_log /var/www/mydomainname.com/log/access.log;
    error_log /var/www/mydomainname.com/log/error.log warn;

    # Typically I create a restrictions.conf file that I then include across all of my vhosts
    #include conf.d/restrictions.conf;
    # I've included the content of my restrictions.conf in-line for this example

    # BEGIN restrictions.conf
    # Disable logging for favicon
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    # Disable logging for robots.txt
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }
    # END restrictions.conf

    # Typically I create a yiiframework.conf file that I then include across all of my yii vhosts
    #include conf.d/yiiframework.conf;
    # I've included the content of my yiiframework.conf in-line for this example

    # BEGIN yiiframework.conf
    # Block access to protected, framework, and nbproject (artifact from Netbeans)
    location ~ /(protected|framework|nbproject) {
        deny all;
        access_log off;
        log_not_found off;
    }

    # Block access to theme-folder views directories
    location ~ /themes/\w+/views {
        deny all;
        access_log off;
        log_not_found off;
    }

    # Attempt the uri, uri+/, then fall back to yii's index.php with args included
    # Note: old examples use IF statements, which nginx considers evil, this approach is more widely supported
    location / {
        #root /var/www/public_html/yii/frontend/web;
        try_files $uri $uri/ /yii/frontend/web/index.php$is_args$args;
    }
    # END yiiframework.conf

    location = / {
	#rewrite /yii/frontend/web/index.php last;
	try_files $uri /yii/frontend/web/index.php/ /yii/frontend/web/index.php;
    }


    # Tell browser to cache image files for 24 hours, do not log missing images
    # I typically keep this after the yii rules, so that there is no conflict with content served by Yii
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|woff2|ttf|woff)$ {
	root /var/www/public_html/yii/frontend/web;
        #expires 24h;
        log_not_found off;
    }

    # Block for processing PHP files
    # Specifically matches URIs ending in .php
    location ~ \.php$ {
        try_files $uri =404;

        # Fix for server variables that behave differently under nginx/php-fpm than typically expected
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # Include the standard fastcgi_params file included with nginx
        include fastcgi_params;
        fastcgi_param  PATH_INFO        $fastcgi_path_info;
        fastcgi_index index.php;
        # Override the SCRIPT_FILENAME variable set by fastcgi_params
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        # Pass to upstream PHP-FPM; This must match whatever you name your upstream connection
        fastcgi_pass phpfpm;
    }
}
server {
    listen 80;
    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/api.mydomainname.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/api.mydomainname.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
 
        #root /var/www/sub.test.com;
        #index index.html index.htm index.nginx-debian.html;

        server_name api.mydomainname.com www.api.mydomainname.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        #proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        # the next 3 lines are for cocket protocol nedded both for web ui and mobile app
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
</code></pre>
<p dir="auto">תודה לעוזרים</p>
]]></description><link>https://tchumim.com/post/69974</link><guid isPermaLink="true">https://tchumim.com/post/69974</guid><dc:creator><![CDATA[חוקר]]></dc:creator><pubDate>Mon, 05 Aug 2019 11:00:31 GMT</pubDate></item><item><title><![CDATA[Reply to מספר שרתי אינטרנט בשרת אחד on Sun, 04 Aug 2019 22:26:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/%D7%97%D7%95%D7%A7%D7%A8">@<bdi>חוקר</bdi></a> אמר ב<a href="/post/69939">מספר שרתי אינטרנט בשרת אחד</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dovid">@<bdi>dovid</bdi></a><br />
אני חייב להשאיר את רוט כנ"ל כי בחלק מהאתר יש לי סקריפטים שלא קשורים לYII, ושם בקוד כתבתי מיקומים לפי המיקום של הרוט, לכן את הרוט השארתי על התיקיה הציבורית האמיתית, ורק מה שאינו קיים לפי הניתוב האמיתי שיופנה לYII בכתובת של התיקיה של הYII.<br />
וכן כי סקריפטים אלו נמצאים במיקום /var/www/public_html/api ולא  בתוך /var/www/public_html/yii/frontend/web<br />
הבעיה תופסת רק בכתובת הראשית ממש שזה קיים גם באמת (כי התיקיה public_html קיימת), ולמעשה שם אני כן רוצה שיופנה לתיקית YII</p>
</blockquote>
<p dir="auto">מצאתי פיתרון זה מגדיר סיפיציפי את הURL כשהוא ללא שום פרמטר אל הנתיב הראשי של YII</p>
<pre><code>   location = / {
        try_files $uri /yii/frontend/web/index.php/ /yii/frontend/web/index.php;
    }
</code></pre>
<p dir="auto">ייתכן שניתן להגדיר את זה יותר חכם, אשמח לדעת מה אמור להיות הפקודה הנכונה שיפנה מיידית לURL המבוקש ללא בדיקה האם קיים או לא.</p>
]]></description><link>https://tchumim.com/post/69942</link><guid isPermaLink="true">https://tchumim.com/post/69942</guid><dc:creator><![CDATA[חוקר]]></dc:creator><pubDate>Sun, 04 Aug 2019 22:26:18 GMT</pubDate></item><item><title><![CDATA[Reply to מספר שרתי אינטרנט בשרת אחד on Sun, 04 Aug 2019 21:39:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dovid">@<bdi>dovid</bdi></a><br />
אני חייב להשאיר את רוט כנ"ל כי בחלק מהאתר יש לי סקריפטים שלא קשורים לYII, ושם בקוד כתבתי מיקומים לפי המיקום של הרוט, לכן את הרוט השארתי על התיקיה הציבורית האמיתית, ורק מה שאינו קיים לפי הניתוב האמיתי שיופנה לYII בכתובת של התיקיה של הYII.<br />
וכן כי סקריפטים אלו נמצאים במיקום /var/www/public_html/api ולא  בתוך /var/www/public_html/yii/frontend/web<br />
הבעיה תופסת רק בכתובת הראשית ממש שזה קיים גם באמת (כי התיקיה public_html קיימת), ולמעשה שם אני כן רוצה שיופנה לתיקית YII</p>
]]></description><link>https://tchumim.com/post/69939</link><guid isPermaLink="true">https://tchumim.com/post/69939</guid><dc:creator><![CDATA[חוקר]]></dc:creator><pubDate>Sun, 04 Aug 2019 21:39:07 GMT</pubDate></item><item><title><![CDATA[Reply to מספר שרתי אינטרנט בשרת אחד on Sun, 04 Aug 2019 21:35:13 GMT]]></title><description><![CDATA[<p dir="auto">לא הבנתי. ההגדרה שלך ל תואמת לדעתי לנתיבים הנכונים. למיטב הבנתי בroot אתה אמור לכתוב</p>
<pre><code>root  /var/www/public_html/yii/frontend/web;
index index.php index.html index.htm;
</code></pre>
<p dir="auto">בtry_file</p>
<pre><code>    try_files $uri $uri/ /index.php?$args;
</code></pre>
<p dir="auto">לקבצים הסטטיים תניח בינתיים, ותדאג להפעיל מחדש את האנג'ינאיקס על כל שינוי.</p>
]]></description><link>https://tchumim.com/post/69937</link><guid isPermaLink="true">https://tchumim.com/post/69937</guid><dc:creator><![CDATA[dovid]]></dc:creator><pubDate>Sun, 04 Aug 2019 21:35:13 GMT</pubDate></item><item><title><![CDATA[Reply to מספר שרתי אינטרנט בשרת אחד on Sun, 04 Aug 2019 21:09:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dovid">@<bdi>dovid</bdi></a><br />
אלו ההגדרות ששמתי</p>
<pre><code># Implement upstream connection to PHP-FPM
# "phpfpm" here is a name for this upstream connection, which you can customize
# I create a custom upstream connection per vhost, to better segregate PHP processes by vhost
# To do the same, you need a unique upstream name, and a unique filename for your php5-fpm.sock file
upstream phpfpm {
    server unix:/var/run/php/php7.2-fpm.sock;
    #avoid sockets for nginx-fpm on Linux, they are good for BSD
    #server 127.0.0.1:9000;
}

server {
    # Listening on port 80 without an IP address is only recommended if you are not running multiple v-hosts
    #listen       80;
    # Bind to the public IP bound to your domain
    #listen 8888;
    listen         8888 default_server;
    listen         [::]:8888 default_server;

    # Specify this vhost's domain name
    server_name mydomainname.com;
    root /var/www/public_html;
    index index.php index.html index.htm;

    # Specify log locations for current site
    access_log /var/www/mydomainname.com/log/access.log;
    error_log /var/www/mydomainname.com/log/error.log warn;

    # Typically I create a restrictions.conf file that I then include across all of my vhosts
    #include conf.d/restrictions.conf;
    # I've included the content of my restrictions.conf in-line for this example

    # BEGIN restrictions.conf
    # Disable logging for favicon
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    # Disable logging for robots.txt
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }
    # END restrictions.conf

    # Typically I create a yiiframework.conf file that I then include across all of my yii vhosts
    #include conf.d/yiiframework.conf;
    # I've included the content of my yiiframework.conf in-line for this example

    # BEGIN yiiframework.conf
    # Block access to protected, framework, and nbproject (artifact from Netbeans)
    location ~ /(protected|framework|nbproject|class) {
        deny all;
        access_log off;
        log_not_found off;
    }

    # Block access to theme-folder views directories
    location ~ /themes/\w+/views {
        deny all;
        access_log off;
        log_not_found off;
    }

    # Attempt the uri, uri+/, then fall back to yii's index.php with args included
    # Note: old examples use IF statements, which nginx considers evil, this approach is more widely supported
    location / {
        #root /var/www/public_html/yii/frontend/web;
        try_files $uri $uri/ /yii/frontend/web/index.php$is_args$args;
    }
    # END yiiframework.conf

    # Tell browser to cache image files for 24 hours, do not log missing images
    # I typically keep this after the yii rules, so that there is no conflict with content served by Yii
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|woff2|ttf|woff)$ {
	root /var/www/public_html/yii/frontend/web;
        #expires 24h;
        log_not_found off;
    }

    # Block for processing PHP files
    # Specifically matches URIs ending in .php
    location ~ \.php$ {
        try_files $uri =404;

        # Fix for server variables that behave differently under nginx/php-fpm than typically expected
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        # Include the standard fastcgi_params file included with nginx
        include fastcgi_params;
        fastcgi_param  PATH_INFO        $fastcgi_path_info;
        fastcgi_index index.php;
        # Override the SCRIPT_FILENAME variable set by fastcgi_params
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        # Pass to upstream PHP-FPM; This must match whatever you name your upstream connection
        fastcgi_pass phpfpm;
    }
}
</code></pre>
<p dir="auto">על פניו הכל תקין.<br />
מלבד שבכתובת הראשית <a href="http://mydomainname.com:8888" target="_blank" rel="noopener noreferrer nofollow ugc">mydomainname.com:8888</a>  זה פותח את הדף index שמופיע ב /var/www/public_html ואם אני מוחק אותו הוא נותן לי שגיאה 403 שזה בעצם אין גישה לאינדקס, ובכל מקרה הוא לא מנתב את הראשי לכתובת המבוקשת<br />
/var/www/public_html/yii/frontend/web/index.php</p>
]]></description><link>https://tchumim.com/post/69927</link><guid isPermaLink="true">https://tchumim.com/post/69927</guid><dc:creator><![CDATA[חוקר]]></dc:creator><pubDate>Sun, 04 Aug 2019 21:09:13 GMT</pubDate></item><item><title><![CDATA[Reply to מספר שרתי אינטרנט בשרת אחד on Sun, 04 Aug 2019 20:26:06 GMT]]></title><description><![CDATA[<p dir="auto">לא הבנתי במה לא הסתדרת עם מה שהבאתי.<br />
תעשה העתק הדבק, שנה את הנתיבים הבודדים וזהו.</p>
]]></description><link>https://tchumim.com/post/69922</link><guid isPermaLink="true">https://tchumim.com/post/69922</guid><dc:creator><![CDATA[dovid]]></dc:creator><pubDate>Sun, 04 Aug 2019 20:26:06 GMT</pubDate></item><item><title><![CDATA[Reply to מספר שרתי אינטרנט בשרת אחד on Sun, 04 Aug 2019 19:38:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dovid">@<bdi>dovid</bdi></a><br />
לא הסתדרתי עם זה.<br />
הבעיה היא כך, הנתיב האמיתי של תיקיית שורש הינו</p>
<pre><code>/var/www/public_html/
</code></pre>
<p dir="auto">מאידך התיקיה של YII הינו</p>
<pre><code>/var/www/public_html/yii/frontend/web
</code></pre>
<p dir="auto">לעומת זאת יש בתקיה הראשית תיקיה כגון api שיש שם סקריפטים של PHP שאני כן רוצה שיהיה אליהם גישה.<br />
אז למעשה עלי לסדר כמה נקודות.<br />
בגישה לנתיב הראשי / יפנה ל</p>
<pre><code>/var/www/public_html/yii/frontend/web/index.php
</code></pre>
<p dir="auto">גישה לקבצים סטטים תיהיה בתוך תיקיית</p>
<pre><code>/var/www/public_html/yii/frontend/web/
</code></pre>
<p dir="auto">ומאידך DOCUMENT_ROOT שישאר (עבור פעולות שתלויות בזה בPHP)</p>
<pre><code>/var/www/public_html/
</code></pre>
<p dir="auto">גישה למספר תיקיות מצוינות כגון api יתבצע לפי הנתיב מהשורש הנ"ל. /var/www/public_html/<br />
כל שאר הניתובים כגון<br />
<a href="http://domain.com/site/login" target="_blank" rel="noopener noreferrer nofollow ugc">http://domain.com/site/login</a><br />
יבוצעו לתיקיית YII לקובץ</p>
<pre><code>/var/www/public_html/yii/frontend/web/index.php
</code></pre>
<p dir="auto">מקוה שכתבתי ברור את הדרישות.<br />
תודה</p>
]]></description><link>https://tchumim.com/post/69919</link><guid isPermaLink="true">https://tchumim.com/post/69919</guid><dc:creator><![CDATA[חוקר]]></dc:creator><pubDate>Sun, 04 Aug 2019 19:38:06 GMT</pubDate></item><item><title><![CDATA[Reply to מספר שרתי אינטרנט בשרת אחד on Sun, 04 Aug 2019 18:56:37 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://www.yiiframework.com/wiki/153/using-yii-with-nginx-and-php-fpm?revision=6" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.yiiframework.com/wiki/153/using-yii-with-nginx-and-php-fpm?revision=6</a></p>
]]></description><link>https://tchumim.com/post/69917</link><guid isPermaLink="true">https://tchumim.com/post/69917</guid><dc:creator><![CDATA[dovid]]></dc:creator><pubDate>Sun, 04 Aug 2019 18:56:37 GMT</pubDate></item><item><title><![CDATA[Reply to מספר שרתי אינטרנט בשרת אחד on Sun, 04 Aug 2019 17:28:40 GMT]]></title><description><![CDATA[<p dir="auto">הלכתי על lemp.<br />
מה שהוצרכתי לעשות היה ס"ה להתקין את phpfpm.<br />
עדיין לא שיניתי את פורט 80 עד שהכל יסודר.<br />
למעשה זה עובד לי להריץ PHP עם הNGINX.<br />
אך מה שנותר לי הוא להסתדר עם קובץ התצורה של NGINX.<br />
העניין הוא שאני משתמש עם YII2 עם ניתובים יפים כמו שמופיע כאן<br />
<a href="https://www.yiiframework.com/doc/guide/2.0/en/start-installation#recommended-nginx-configuration" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.yiiframework.com/doc/guide/2.0/en/start-installation#recommended-nginx-configuration</a><br />
אז מצד אחד אני צריך להגדיר שהכל יופנה לindex.php שבתוך התיקיית YII.<br />
ומצד שני אני רוצה לשלול כמה תיקיות שבהם לא ינותב כלל לYII.<br />
איך אני אמור לעשות זאת?<br />
תודה</p>
]]></description><link>https://tchumim.com/post/69900</link><guid isPermaLink="true">https://tchumim.com/post/69900</guid><dc:creator><![CDATA[חוקר]]></dc:creator><pubDate>Sun, 04 Aug 2019 17:28:40 GMT</pubDate></item><item><title><![CDATA[Reply to מספר שרתי אינטרנט בשרת אחד on Sun, 04 Aug 2019 10:31:04 GMT]]></title><description><![CDATA[<p dir="auto">אכן אל תעבוד לפי פורטים.</p>
<ol>
<li>האפשרות המידיית והיותר פשוטה זה לשנות את הפורט של הapach ל8080 למשל, ולהאזין הכל דרך הnginx ולהפנות לפי ההוסט לאיפה שצריך.</li>
<li>תוכל גם לסלק את האפאצ' כפי שהצעת ולעבור לLEMP (לא LNMP כי nginx נקרא בפועל n-ginix ובעברית אנג'יניקס, אז זה E).<br />
זה פחות קל ואולי יותר מומלץ בגלל ריכוזיות (מקום אחד לכל ההגדרות, הnginx).</li>
</ol>
]]></description><link>https://tchumim.com/post/69876</link><guid isPermaLink="true">https://tchumim.com/post/69876</guid><dc:creator><![CDATA[dovid]]></dc:creator><pubDate>Sun, 04 Aug 2019 10:31:04 GMT</pubDate></item><item><title><![CDATA[Reply to מספר שרתי אינטרנט בשרת אחד on Sun, 04 Aug 2019 08:49:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/%D7%97%D7%95%D7%A7%D7%A8">@<bdi>חוקר</bdi></a><br />
אתה צריך reverse proxy<br />
דובר על זה כאן לא מזמן<br />
אפשר לעשות את זה עם NGNIX וגם / או עם LAMP</p>
<p dir="auto"><a href="https://tchumim.com/topic/5792/%D7%94%D7%A4%D7%A0%D7%99%D7%99%D7%AA-%D7%AA%D7%AA-%D7%93%D7%95%D7%9E%D7%99%D7%99%D7%9F-%D7%9C%D7%A4%D7%95%D7%A8%D7%98-%D7%9E%D7%A1%D7%95%D7%99%D7%99%D7%9D-%D7%91ip">https://tchumim.com/topic/5792/הפניית-תת-דומיין-לפורט-מסויים-בip</a></p>
]]></description><link>https://tchumim.com/post/69873</link><guid isPermaLink="true">https://tchumim.com/post/69873</guid><dc:creator><![CDATA[clickone]]></dc:creator><pubDate>Sun, 04 Aug 2019 08:49:44 GMT</pubDate></item></channel></rss>