I am using AWS Cloud9 as my IDE for PHP web development. I have set up the environment on AWS with all the default settings and all appears to be working. I can use the "Run" and "Preview" functions in the IDE to run my .php file. However, it is using the "PHP (Built-in web server)" as default to run.
How do I run it through Apache HTTP instead? There isn't an option in the list of Runners. I can create one, but have no idea how to. I can see that Apache HTTP is available on the default EC2, though.
There is no option in the list of runners. You have to manually configure Apache to run on ports 8080, 8081 or 8082.
This page details how to run Apache on AWS EC2 Cloud9 server (port, root directory and htaccess): How to configure and run Apache server on AWS EC2 Cloud9?
Related
I am developing a website using Laravel as backend and Vue.js 2 as frontend. Now everytime i want to run my website I have to use 2 command:
php artisan serve
This will run the laravel server on port 8000
npm run dev
This will run the vue.js server on port 8080
Can I just run them on the same server (same port), with just one command only??
If you use the Laravel app with Vue.js included in it, you don't need to run npm run dev.
In your case, you seem to have a decoupled frontend and backend. In that case, you don't really have the choice to host 2 different ports or hostname.
You can use the same port if you use a different domain. For example, you can use mydomain.com for the frontend and use api.mydomain.com for the backend/api.
Assuming you have a webpack frontend project, you can do npm run build, which will compile all your files to static html files in the dist folder. You then only need to point your host configuration file to this folder.
I have scp'ed a php backend app (rest server) to a remote ubuntu host on aws. When I was testing it locally I would just do a simple php -S localhost:8888 for testing the service locally. But now that I have it on a remote host (aws) which has a public ip address, I'm not sure how to start the app. How do I start this app?
So when I try to access the app from any where such as:
http://<server_addr>/api/get/record/1
I'll get expected response payload and 200 response code
To make it work try
php -S 0.0.0.0:8888
That way the server is going to listen on any interface. It doesn't work externally because it is listening only on the 127.0.0.1 interface.
With php -S localhost:8888 if you make a request with wget or curl, connected via ssh to the php server, it should get the content.
As the other answer says, try apache. The php built-in server is just for local development as the docs estipulate.
This web server was designed to aid application development. It may
also be useful for testing purposes or for application demonstrations
that are run in controlled environments. It is not intended to be a
full-featured web server. It should not be used on a public network
http://php.net/manual/en/features.commandline.webserver.php
Edit: Oh, and here you have the AWS docs on how to setup the apache server:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
To host a PHP based application you will need a webserver with php module enabled. For example you can use apache httpd server (I would suggest you to use if your website is php based). Once your server is installed you should be able to access it on http://yourserveraddress:serverport
To install http with php module on an ubuntu machine you just need to run this command (in most of the cases).
sudo apt-get install apache2
I'm new to web development.
I installed Apache and PHP separately, not using XAMPP. Then I notice that after I create a PHP project, I could put it into htdocs folder and launch httpd from Apache and working fine. But if I use php -S localhost:80 -t my_folder, no matter which port I'm using, I can't access it via any browser or cURL.
My computer is running Windows 10 with Anniversary update and ZoneAlarm. I'm not quite sure if these information are related. Please let me know if I need to provide more information to identify the problem.
Thanks!
I'm doing live chat server on my laravel development, I setup everything in Digital Ocean. Setup apache2 and phpmyadmin. However, when I tried to run the
"php artisan serve"(Default port:8000)
then open up my website with IP. The server commands didn't detect anything. Fine. I try my live chat server
"php artisan chat:serve --port=8887"
with different ports. But didn't work for me, it shows blank screen without errors. Suppose shows me live chat messeger interface on my website but blank. I know something deals to my apache2 server, but I have no idea how to deals with it.
By the way, I'm using emberJS chat server and follow-up this tutorial at here
php artisan serve is intended for local development, and as such, limits itself to the local network by default. Doing php artisan serve --host 0.0.0.0 will allow it to be accessible to the public internet.
Do note that php artisan serve should never be used to serve a production site. You should be serving the live site with Apache, not Artisan.
I have been newly introduced to AMAZON EC2 Server. Recently I created a micro instance EC2 Ubuntu and installed Apache, PHP & MySql.
I have some PHP files including an index.php. I have uploaded my files to /var/www/html directory. Now when i open my Public DNS in browser it shows nothing. The same thing is working in my localhost setup.
Is there something enabling mod rewrite in EC2 Ubuntu instance ?
Please help.
Thanks in advance.
Enable inbound and outbound rules for port 80 (http) in your security group(s) that is assigned for the instance. By default the only inbound rule is ssh (port 22) and all outbound rules are enabled. So you might only need to change the inbound rule.