Fixing router mode

What issue or error are you experiencing?

I am unable to run the site using Router Mode Sites Domain.
When I try to Open Site, it appears that Local automatically appends the site port to the end:

I found an article by flywheel explaining why this happens. From what I understood, is because there might be another application listening to port 80 already.

I am on Mac, so running the command sudo lsof -i:80; sudo lsof -tnP -i:80 | xargs -n 1 ps -p displays the following:

bruno@Brunos-MacBook-Pro ~ % sudo lsof -i:80; sudo lsof -tnP -i:80 | xargs -n 1 ps -p

Google     620 bruno   87u  IPv4 0x620f890482b58675      0t0  TCP> (ESTABLISHED)
nginx     5146 bruno    5u  IPv4 0x620f890482b63bdd      0t0  TCP *:http (LISTEN)
nginx     5146 bruno    6u  IPv6 0x620f88ffa98ce965      0t0  TCP *:http (LISTEN)
nginx     5151 bruno    5u  IPv4 0x620f890482b63bdd      0t0  TCP *:http (LISTEN)
nginx     5151 bruno    6u  IPv6 0x620f88ffa98ce965      0t0  TCP *:http (LISTEN)
  PID TTY           TIME CMD
  620 ??         0:37.54 /Applications/Google Chrome Framework.framework/Versions/120.0.6099.129/Helpers/Google Chrome Help
  PID TTY           TIME CMD
 5146 ??         0:00.03 nginx: master process /Users/bruno/Library/Application Support/Local/lightning-services/nginx-1.16.0+7/bin/darwin/sbin/nginx -c /Users/b
  PID TTY           TIME CMD
 5151 ??         0:00.03 nginx: worker process    
bruno@Brunos-MacBook-Pro ~ % 

I don´t quite understand what that output means. I was expecting to see some application name on the output, but as you can see there is not. There appear to be four nginx processes running, I don’t know where that comes from. I could kill them, but I never like to do smothing I don’t understand.

I just have two sites on local, and both are using Apache. Besides, the other site is not running.
Any help to fix this is much appreciated.

As always, loving flywheel! :heart_eyes: :heart_eyes:

What steps can be taken to replicate the issue? Feel free to include screenshots, videos, etc

System Details

  • Local Version:

  • Operating System (OS) and OS version:
    macOS Monterey Version 12.7.1

Local Logs

Attach your Local Logs here (Help Doc - Retrieving Local’s Log)

{"thread":"main","class":"AddonLoaderService","level":"info","message":"Loading Add-on: %%resourcesPath%%/lightning-services/mailhog-1.0.0+3/lib/main.js","timestamp":"2023-01-27T14:4$
{"thread":"main","class":"AddonLoaderService","level":"info","message":"Successfully Loaded Add-on: %%resourcesPath%%/lightning-services/mailhog-1.0.0+3/lib/main.js","timestamp":"202$
{"thread":"main","class":"AddonLoaderService","level":"info","message":"Loading Add-on: %%resourcesPath%%/lightning-services/mariadb-10.4.10+4/lib/main.js","timestamp":"2023-01-27T14$
{"thread":"main","class":"AddonLoaderService","level":"info","message":"Successfully Loaded Add-on: %%resourcesPath%%/lightning-services/mariadb-10.4.10+4/lib/main.js","timestamp":"2$
{"thread":"main","class":"AddonLoaderService","level":"info","message":"Loading Add-on: %%resourcesPath%%/lightning-services/mysql-8.0.16+6/lib/main.js","timestamp":"2023-01-27T14:42$
{"thread":"main","class":"AddonLoaderService","level":"info","message":"Successfully Loaded Add-on: %%resourcesPath%%/lightning-services/mysql-8.0.16+6/lib/main.js","timestamp":"2023$
{"thread":"main","class":"AddonLoaderService","level":"info","message":"Loading Add-on: %%resourcesPath%%/lightning-services/nginx-1.16.0+6/lib/main.js","timestamp":"2023-01-27T14:42$
{"thread":"main","class":"AddonLoaderService","level":"info","message":"Successfully Loaded Add-on: %%resourcesPath%%/lightning-services/nginx-1.16.0+6/lib/main.js","timestamp":"2023$
{"thread":"main","class":"AddonLoaderService","level":"info","message":"Loading Add-on: %%resourcesPath%%/lightning-services/php-8.1.9+8/lib/main.js","timestamp":"2023-01-27T14:42:31$
{"thread":"main","class":"AddonLoaderService","level":"info","message":"Successfully Loaded Add-on: %%resourcesPath%%/lightning-services/php-8.1.9+8/lib/main.js","timestamp":"2023-01$
{"thread":"main","class":"AddonLoaderService","message":"Add-on does not have \"productName\" specified in package.json: %%appPath%%/node_modules/@getflywheel/local-components/packag$
{"thread":"main","class":"AddonLoaderService","message":"Add-on does not have \"productName\" specified in package.json: %%appPath%%/node_modules/@getflywheel/localcert/package.json"$
{"thread":"main","class":"AddonLoaderService","message":"Add-on does not have \"productName\" specified in package.json: %%appPath%%/node_modules/@getflywheel/localtunnel/package.jso$
{"thread":"main","class":"AddonLoaderService","message":"Add-on does not have \"main\" or \"renderer\" specified in package.json: %%appPath%%/node_modules/@getflywheel/replacestream/$
{"thread":"main","name":"DeprecationWarning","code":"DEP0128","level":"info","message":"Warning:Invalid 'main' field in '%%appPath%%/node_modules/ssh-key-to-pem/package.json' of 'lib$
{"thread":"main","class":"GraphQLService","message":"GraphQL server ready at","level":"verbose","timestamp":"2023-01-27T14:42:31.612Z"}
{"thread":"main","class":"GraphQLService","message":"GraphQL subscriptions ready at ws://","level":"verbose","timestamp":"2023-01-27T14:42:31.613Z"}
{"localVersion":"6.6.0+6231","osPlatform":"darwin","osRelease":"21.6.0","osArch":"x64","windowsEdition":null,"linuxEdition":null,"level":"warn","message":"Electron Event ready","time$
{"thread":"main","class":"Updater","level":"info","message":"Checking for updates for: darwin-x64-production","timestamp":"2023-01-27T14:42:41.489Z"}
{"thread":"main","class":"Updater","release":null,"level":"debug","message":"Check for updates result","timestamp":"2023-01-27T14:42:41.936Z"}
{"thread":"main","class":"SiteProvisionerService","message":"Creating site folders...","level":"info","timestamp":"2023-01-27T14:44:18.324Z"}
{"thread":"main","class":"SiteProvisionerService","message":"Copying service config templates...","level":"info","timestamp":"2023-01-27T14:44:18.332Z"}
{"thread":"main","class":"ConfigTemplatesService","message":"Compiling service configs...","level":"info","timestamp":"2023-01-27T14:44:18.386Z"}
{"thread":"main","service":{},"serviceBinVersion":{},"dataPath":"%%site.runData%%/mysql/data","level":"info","message":"Initializing MySQL datadir...","timestamp":"2023-01-27T14:44:1$
{"thread":"main","class":"ConfigTemplatesService","message":"Compiling service configs...","level":"info","timestamp":"2023-01-27T14:44:24.142Z"}
{"thread":"main","class":"RouterService","level":"debug","message":"Running proxyManager::add","timestamp":"2023-01-27T14:44:24.463Z"}
{"thread":"main","class":"X509CertService","level":"debug","message":"genexusblog.local.key already exists. Skipping certificate creation.","timestamp":"2023-01-27T14:44:24.467Z"}
{"thread":"main","service":{},"serviceBinVersion":{},"message":"Setting up MySQL user...","level":"info","timestamp":"2023-01-27T14:44:24.473Z"}
{"thread":"main","class":"Process","process":"mysql","level":"warn","message":"2023-01-27T14:44:24.571678Z 0 [System] [MY-010116] [Server] %%resourcesPath%%/lightning-services/mysql-$

Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

Hi @brfignoni

If you stop all sites that are running and force quit Local, then run this command lsof -nP -iTCP -sTCP:LISTEN that should give you an idea of what might still be interfering. What you’ll be looking for here is to see when sites are stopped and Local is properly shut down if there are still programs running on ports 80 and 443. These may be conflicting with Local or the system may be reporting Local is still running.

Once you run that command you should see a list of listening ports. If you see a particular program making use of those ports, you can then kill that process by running sudo kill -9 XXX where XXX is the PID number of that process.

After that, you should be able to retry. Another thing to try would be to see if changing the site’s from Apache to NGINX allows them to function on Site Domains.

There are also some more details around this and other troubleshooting steps at this link if needed: Stopping Whatever Is Listening On Port 80.

Thank you very much for your help. I tried the command that you suggested. I see some information, but not the detail about the port number:

Am I missing something?
I will try your suggestion about using NGINX, however I have a couple of concerns about using this server:

  1. The production server that is on is probably using Apache. In that case, I think is better to use the same server, in order to reproduce the local site as close as the production site. What do you think?

  2. I really like to get the images from production, and for that I am using a rule on .htaccess file, and as far as I am concerned, that runs on Apache, not on NGINX.

@Nick-B forget about number 2. I just found this article that explains how to get production images with NGINX as well: Serve Missing Media from a Production Server via Apache/Nginx – From the Desk of Brian Richards

Before running the flywheel local site, there appears to be nothing listening to port 80. Then I started one site, on Apache, and there appear to be two processes listening to port 80. The COMMAND shows nginx. Why nginx if I am running with Apache?

My issue persists. I still get the port number after the local domain:

Hi @brfignoni

Just to check here are you running other developer applications simultaneously? That could also cause similar issues. Apps like MAMP, XAMPP, or Docker for example.

Can you share an updated Local Log here as well? There are some different ways to access and share Local Logs. For us to be able to troubleshoot thoroughly, please click the Download Local Logs button from the Support tab in Local. This will generate a zip archive that contains the Local log along with some other diagnostic information to help quickly zero in on any issues that Local is encountering.

Hi @Nick-B thank you for your help and quick answer.

I use Docker, but it is not running.

I do have MAMP installed, but it is not running neither. I rarely use it nowadays. Also, the port for Apache is different: 8888

Can you share an updated Local Log here as well?
Sure, here you go: GitHub - brfignoni/flywheel-log

My last try was today. to find for logs from today search: 2024-01-13

Feel free to ask me anything you need. Thank you in advance.

@Nick-B Hello, good morning. Just a reminder that I responded your last comments/question. Good day.

@Nick-B I just created a new site, and is working fine. I think the issue might be related to the fact that the site domain that is having issues, has a sub-domain:

1 Like

Hi @brfignoni - Thank you for your patience I was just circling back here. I’m glad you were able to create and access a new site that’s a good sign!

So is the current site a multisite install?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.