Hi,
i installed laravel and vue.js in an apache server. When i run vue from my terminal it works http://localhost:8080. When i try to check it externally like http://138.68.xxx.xxx:8080/, i see only This site can’t be reached.
I visited http://portquiz.net:8080/ and the result is that: You have reached this page on port 8080. Your network allows you to use this port.
I haven’t done anything yet because i am not experienced with servers. I read about vhosts etc, but a guidance or help for someone more experienced would be more than welcome.
Thank you
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I’m assuming you’re running php artisan serve. Running that should output:
Laravel development server started: <http://127.0.0.1:8000>
Notice how it says the server is accessible through http://127.0.0.1:8000 that is equivalent to http://localhost:8000. Since it’s a development server, Laravel makes it accessible on the localhost loopback interface only, which means that it wouldn’t be accessible from outside of the Droplet as a security measure. That’s why browsing to http://138.68.xxx.xxx:8080/ isn’t working.
Since you have Apache set up, edit the Apache config and make sure DocumentRoot for your domain name is set to /path/to/laravel/public (for example: /var/www/html/laravel/public). Doing so should allow Apache to serve your Laravel application in a production environment, on port 80.
Heya,
appears that your Vue.js application is only listening on localhost, which makes it unreachable from external IPs. Additionally, there could be a firewall that’s blocking external access to port 8080. Here’s how you can try to resolve it:
Make sure your Vue.js application is listening on 0.0.0.0 (all network interfaces), not just 127.0.0.1 (localhost). When running your Vue.js development server, you can usually specify the host like so:
npm run serve -- --host 0.0.0.0
This will allow the Vue.js development server to accept connections from any IP address, not just localhost.
If your Vue.js app is configured to listen on all interfaces, but you still can’t access it externally, there might be a firewall that’s blocking external access to port 8080. You can open the port using ufw (Uncomplicated Firewall) if it’s installed and active:
sudo ufw allow 8080/tcp
If you have Apache installed and you want to serve your Vue.js app through it, you can set up Apache as a reverse proxy to forward requests to your Vue.js app. Here’s a basic example of an Apache virtual host configuration as a reverse proxy:
Create a new configuration file, for example, vueapp.conf in /etc/apache2/sites-available:
<VirtualHost *:80>
ServerName your-domain-or-ip
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ErrorLog ${APACHE_LOG_DIR}/vueapp_error.log
CustomLog ${APACHE_LOG_DIR}/vueapp_access.log combined
</VirtualHost>
Enable the site:
sudo a2enmod proxy
sudo a2enmod proxy_http
Ensure that the proxy and proxy_http modules are enabled:
sudo a2enmod proxy
sudo a2enmod proxy_http
After performing the above steps, try accessing your Vue.js application using your external IP or domain, without specifying the port, like http://138.68.xxx.xxx or http://yourdomain.com.
Remember, allowing external access to your development server and opening ports in your firewall can expose your server to potential security vulnerabilities. It is recommended to use this setup only for development and testing purposes. For production deployments, consider building your Vue.js app and serving the static files through a web server, and ensure that your server is properly secured
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.