localhost.run wordpress ssh tunneling - wordpress

I need to show a preview of a wordpress project to a client. I want to setup a tunnel to expose the macOS apache server instance. In past I was using ngrok but with wordpress it requires some configuration and I don't want to waste time in plugins installation ecc.
I've tried with Serveo, but it seems to be offline at the moment, after a little bit of research I've found localhost.run that offer the same service of Serveo.
How I can find the actual port of the embed apache server of my macOS and how I will expose wordpress without plugins installation?
I've tried with this command
ssh -R 80:localhost:8080 ssh.localhost.run
but it will give an error when I open the tunneling url:
Something went wrong opening the port forward, check your SSH command output for clues!

Try setting the Apache "httpd.conf" to
Listen 8080 and
ServerName localhost:8080

Related

code-server (docker) and nuxt.js / javascript 404

Setup: I use a self-hosted code-server (dockerized) behind a fritzBox on my home lan. I have a FQDN (mysub.mydomain.com) pointing to a dyndns (mysdyn.my-router.com) with a cname entry which ends up on the fritzBox, port forwarded to the docker machine via a nginx reverse proxy with letsencrypt enabeld.
code-server works fine and is available via mysub.mydomain.com. With the live-server plugin works great#code-server and can be reached via mysub.mydomain.com/proxy/3000/ (3000 is an example port). Hot-reload and Javascript works.
Problem: working on a nuxt.js project (universal), when I run "yarn dev" the dev-server comes up normaly and the page can be reached via mysub.mydomain.com/proxy/3000/ and displays correct. But the "hot-reload" as well as all java scripts are not working because of a 404 for all .js-files.
The browser is looking for all .js-files under e.g. https://mysub.mydomain.com/_nuxt/runtime.js which correctly causes the 404, because coorect location would be https://mysub.mydomain.com/proxy/3000/_nuxt/runtime.js
What is causing this behavior and how can I fix this? I am even not sure where to start. Nginx or Nuxt? I already tried to play around with the router-setting in the config.nuxt.js - no luck.
thanks for your help!
So, mysub.mydomain.com/proxy/3000/ is a hosted website behind an Nginx configuration?
If it's the case, you can't use yarn dev. This command is aimed towards a local development server.
You can't have HMR running on a hosted production app through some DNS, reverse proxy, port forwarding and so on. Or at least, this is what this is aimed towards.
Even having hot reload via code-server is kinda not mainstream. So yeah, you could maybe try some hacky things and achieve it, but you'll still end-up experiencing quite some bugs and the performance will probably be sub-par.
You don't want to stick to some local running apps?

blank page with domain name inside

I set up a server on Ubuntu 20.04, installed and configured UFW and fail2ban, installed nginx, opened 80 and 443 ports. Created a config file for my domain and started the server. It works, but from my IP address (from which I set up the server), I cannot get to the site. When I request a domain, I get a white page on which my domain is written in plain text. But as soon as I register the domain and IP in the hosts file, the site becomes available. I see the problem only from my IP, from others - the site is available. I can provide server settings, but they are corny simple. The site is still pure HTML. Even php didn't install.
Help me find the problem, or at least a direction to fix it.
Thanks!
It might be related to cached DNS queries. Remove the entry from /etc/hosts file and restart your local machine.

How to move wordpress website with ssl on localhost?

Website with ssl on wordpress. Moved it on localhost, changed wp-config, changed https://olddomain.ru to http://newdomain.ru.
But still have error ERR_SSL_PROTOCOL_ERROR in browser and Invalid method in request \x16\x03\x01 in apache2 logs.Trying to start it via MAMP. How to disable SSL?
This question relates to current and previous MAMP and MAMP PRO versions. MAMP PRO assists in replicating basic web host production environment on a users local Windows based system.
First, it's best to isolate the problem by disconnecting your system from internet.
Turning off GroupStart for Apache and MySQL by un-checking "Include MySQL in GroupStart" is another isolation problem solving technique:
https://documentation.mamp.info/en/MAMP-PRO-Windows/Servers-and-Services/Apache/
https://documentation.mamp.info/en/MAMP-PRO-Windows/Servers-and-Services/MySQL/
Emptying logs by erasing the log files prior to trying out the steps below is another way to isolate problems:
C:\MAMP\logs
Most local systems have AntiVirus program and the antivirus program usually has software firewall bundled. Be sure to add Web Server and HTTPS ports under ports and services of your choice of AntiVirus software.
1. Custom Domain:
First issue is related to assigning custom domains. A custom domain is assigned by modifying Windows Hosts file to point localhost host with IP 127.0.0.1 to a fictitious domain name.
Here is how the default hosts file looks like:
https://support.microsoft.com/en-us/help/972034/how-to-reset-the-hosts-file-back-to-the-default
Here is the required modification:
hosts file
127.0.0.1 newdomain.ru
::0 localhost
::0 is the bus/port designation of a systems network adapter. Usually the first available network adapter software on a device has ::0 address.
After modifying hosts file be sure to flush dns by using Windows command prompt:
ipconfig /flushdns
2. Location of Virtual Hosts data
MAMP documentation recommends you store virtual Hosts data outside of default C:\MAMP\htdocs directory.
https://documentation.mamp.info/en/MAMP-PRO-Windows/First-Steps/View-Localhost/
3. Serverside language application
MAMP recommends to serve serverside language applications such as WordPress on port 80 in your local development environment.
https://documentation.mamp.info/en/MAMP-PRO-Windows/Troubleshooting/WordPress/WordPress1/

How to install a SSL Certificate for a Wordpress website hosted in a Google Cloud Platform instance?

I just received a zip file containing the mydomain.crt and mydomain.ca-bundle files. I would like to know how to install the certificate for a WordPress website hosted in a Google Cloud Platform instance. I have the instance configured with the common Bitnami software ( Apache 2.4.25, MySQL 5.7.18, OpenSSL 1.0.2k, PHP 7.0.18, phpMyAdmin 4.7.0, SQLite 3.7.15.1, Varnish 4.1.0, WordPress 4.8). I found plugins available from WordPress such as Really Simple SSL or Cloudflare, but I would like to avoid the use of plugins. Thanks.
You want to follow apache instructions on installing SSL cert onto your website. Meaning, you will need to install the certificate by generating the keys and restarting your server. Being on the cloud or being on a hosted server that's not on the cloud shouldn't matter, it's a web server although you have to make sure port :443 is in your security firewall is allowed otherwise you're https request will change.
Once you've done that, and the installation is successful, you should see a lock next to the https request with the domain information you gave when you installed the ssl certificate. Let us know what kind of problems you ran into, otherwise you should be good to go. You may need to change all your referencing urls that is http to https with mysql search and replace query afterwards.
I found all the required information in this page Bitnami WordPress for Google Cloud Platform. Once you have your certificate generated (self-signed or from an official Certificate Authority), which usually contains 2 files (yourdomian.crt and yourdomian.ca-bundle), the simplest procedure is:
Upload those two files to /opt/bitnami/apache2/conf
If it is a fresh install, in that folder you should have the server.key, server.crt and server-ca.crt original files. Make a backup of them and delete them, or just rename them like server_b.key, server_b.crt and server-ca_b.crt
Rename yourdomian.crt to server.crt and yourdomian.ca-bundle to server-ca.crt
In the same folder /opt/bitnami/apache2/conf place a copy of the key used to generate the certificate signing request (CSR), and rename the key to server.key
Open the configuration file with sudo nano/opt/bitnami/apache2/conf/bitnami/bitnami.conf if you are not root.
To the section add SSLCACertificateFile "/opt/bitnami/apache2/conf/server-ca.crt" if using Apache v2.4.8+, or SSLCertificateChainFile "/opt/bitnami/apache2/conf/server-ca.crt" if using Apache < v2.4.8 and save the changes
Make your files only readable by root with sudo chown root:root /opt/bitnami/apache2/conf/server* and sudo chmod 600 /opt/bitnami/apache2/conf/server*
Restart apache with sudo /opt/bitnami/ctlscript.sh restart apache
That worked for me to have a Certificate Authority (CA) produced SSL certificate working for my WordPress site, hosted in a Google Cloud VM without installing any third party plugins. As #unixmiah pointed out, do not forget to open port 443 in the server firewall.

Running symfony 2 on Virtual Box Ubuntu

How the localhost part applies when using a virtual machine to run symfony 2? For example (source: https://symfony.com/doc/master/book/installation.html#running-the-symfony-application): When I see the following on my command prompt:
and enter the browser on my host client, entered http://localhost:8000, the page is not found. When I enter my puphpet virtual host in my browser however, the var/www/index.html is loaded correctly.
Symfony 2 is installed on the virtual machine.
How can I make symfony('s default template) visible on my browser?
Did I forget something, am I missing something or should I read up something?
Edit: $_SERVER['REMOTE_ADDR'] Returned 192.168.56.1 instead of 192.168.56.101.
When you are trying to open http://localhost:8000 on your host then browser calls to your localhost to open this page. Check the IP address of your VM (ifconfig) then on host machine you could call: VM_IP_ADDRESS:8000.
You shouldn't be using PHP's built-in server! PuPHPet has support for both Nginx and Apache. Considering that I see /var/www/awesome tells me that you have either one of those installed.
You should use vhosts to access your app, and add the entry into your system's hosts file (/etc/hosts on Linux/OSX).

Resources