/    Sign up×
Community /Pin to ProfileBookmark

How can I mix proxied Go sites and one PHP site?

I host several small sites on a VPS using Nginx to proxy the domain to correct site. As I am using Go, there is a built in web server that allows me to make the routing very simple (two proxied site in this example):

“`
server {
server_name go4webdev.org www.go4webdev.org;
location / {
proxy_pass http://localhost:9090;
}
}

server {
server_name static.go4webdev.org;
location / {
proxy_pass http://localhost:9091;
}
}
“`

Now I am trying to add a Flarum Forum to this setting in Nginx. As Flarum is built with PHP, this setting in Nginx redirects me to the main domain instead:

“`
server {
server_name forum.go4webdev.org;

root /var/www/flarum/public;
index index.php;

listen localhost:443;

location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

location ~ /. {
deny all;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
log_not_found off;
access_log off;
allow all;
}
}
“`

As PHP not is my native language, I am completely lost. Any clue is welcome.

https://forum.go4webdev.org/ (This should point to a Flarum forum but it point to the main domain)

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@sibertauthorSep 28.2021 — > @sibert#1637576 Now I am trying to add a Flarum Forum to this setting in Nginx

FWIW, I managed to solve this by using PHP FPM. In my world this works as an engine (service) and redirects to the correct port. Then I more or less treat the PHP site as Go site.

After installing PHP FPM I added this in Nginx default settings:

``<i>
</i>server {
root /var/www/flarum/public;
index index.php index.html index.htm;
server_name forum.go4webdev.org;

location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}

include /var/www/flarum/.nginx.conf;
}<i>
</i>
``
Copy linkTweet thisAlerts:
@yuvsaha123Oct 03.2021 — thanks for the awesome information.

https://breakfasthoursofficial.com/walmart-pharmacy-hours

https://breakfasthoursofficial.com/burger-king-breakfast-hours

https://breakfasthoursofficial.com/texas-roadhouse
×

Success!

Help @sibert spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...