How to connect to Directus API in localhost - php

I am trying to setup directus in my website. Since my website is now at localhost I want to connect to API to get database info. I don't know where to point my endpoints in localhost.
My Ampps local server config is
Apache:7.1
sql:5.7.17
Till now I installed composer, then I tried to ping
doc example https://example.com/server/ping
I used https://localhost/server/ping
my directus is located in C:\Program Files (x86)\Ampps\www\trial\directus-master
what will be https://example.com
getting 404 error everytime.

Could you elaborate more, your question is vague with missing information.
Are you saying you have Directus setup on a server, and now you've loaded your website up locally, you want to access that remote instance?
If so, then you need to send your queries to the remote server.
Much like:
https://demo-api.directus.app/server/ping
https://demo-api.directus.app/_/items/sales/1,2,3

Related

Hosting website in XAMPP failed

I have a website which uses AngularJS 1.5.x as front end and PHP as back end. I want to host that on my local machine. I choose XAMPP to do that. I followed the procedure got from different sources but I cannot get that done.
I have done
ng build --prod
It's giving me error like Local workspace file ('angular.json') could
not be found
I am stuck with this problem. I cannot go forward. I am new to AngularJS and PHP. Can some one help me out.
I have got the code from git hub. Just for practice I am trying to host this first. But I am unable to do that.
The folder structure is as

how to rewrite -host-header in ngrok in order to open a sub-website in xampp running on localhost

I am trying to expose my website to internet, using ngrok, my website lives in xampp server which is running on my local machine. the path to my website is this: C:\xampp\htdocs\TheWebsite
when i use the following command for running ngrok client:
ngrok http -host-header=rewrite TheWebsite:8081
the client gets connected to ngrok server, but when i try to access my website on internet using http://234k2h4k24.ngrok.io which is the url ngrok provides for me, i end up with this error:
The connection to http://234k2h4k24.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address TheWebsite:8081.
Make sure that a web service is running on TheWebsite:8081 and that it is a valid address.
The error encountered was: dial tcp: lookup TheWebsite: no such host
how exactly one should set the value for -host-header switch in order to to get the sub-directories (websites) living in htdocs folder in xampp server environment??
I have searched this site and also all over the Internet and i found some quick answers but they confused me even more. like this one:
https://helgesverre.com/blog/expose-local-webserver/
which doesn't even provide a small example
and this: Tunnel a localhost subdirectory through ngrok?
just the same as previous one (no example)
A real good answer needs to provide at least one complete example (i mean, if you want to answer this question, please provide a full example of ngrok command for the path of my website (TheWebsite). thank you
for this purpose i needed to define virtual hosts for each of my websites!
I found the answer in a related question at stackoverflow.com and here it is:
Tunnel a localhost subdirectory through ngrok?
this question leads you to this page which lets you know how to define virtual hosts in order for your local machine to identify where is the requested website, just take a look and you will learn in it no time. here is the page:
http://forum.wampserver.com/read.php?2,127757
although its for wamp but it is the same for xampp server too!

Accessing Azure Server - Request timed out

I just started up an Azure server and have been trying to access it for a while and am having a hard time doing so.
I installed zPanel on my 12.04 Azure Ubuntu server (like cPanel: Apache, MySQL, PHP, etc) and made sure Apache was working and pointed a domain to the server IP and gave it to zPanel's installer to config.
I tried accessing the server through direct IP, through the domain and even pinging it. I keep getting Request timed out.
I'm using the "Resource Manager" in Azure and can't find a way to specifically allow port 80, so I'm assuming it's enabled already, but that's the only reason I can think of for not being able to access the server. Any ideas?
Try to add the specifical port on the Azure old portal or new portal, please see the pictures below.
Fig 1. Add the endpoints(ports) on Azure old portal
Fig 2. Add the endpoints(ports) on Azure new portal
Hope it helps. Best Regards.

How to clone my website (cakephp) to localhost?

I have installed Wampserwer on my computer, and I have access to files on hosting via WinSCP.
Website is running on CakePHP
Can anyone, please, explain what steps do I need to do, to make a copy of my website on localhost. I cant find any usefull instructions
Thanks!
localhost is working
access via winscp to files
Copy the files to your computer
If your site uses a database, you have import that one, too + create a user/password
You have to configure your webserver for Cake. Find instructions here: http://book.cakephp.org/3.0/en/installation.html#installing-cakephp (in your case, search for Apache)

How do I execute PHP on a cPanel server?

I have a LAMP application that works. I can deploy this in 15 minutes on a Linux server. I was handed a VPS to deploy it. All I get is WHM. I created an account and that got me a login to cPanel and to the box. cPanel ran some wizard that told me to put my "web source files" in /public_html There is an /cgi-bin inside of that. I cannot get any web assets to be visible from any of those folders. All I get is 404 not found. chmod 777. 404 not found.
My simple question is this: how could I get a simple hello world PHP script to run on a cPanel server? I've been building web pages since before we called them web pages. I do not need to know anything about PHP itself I want to know how to get the cPanel managed server to run PHP scripts. All the documentation I can find on cPanel assumes you've been using it forever. I just need some basic information. Where do I put my PHP code ?????
This is the way cPanel works. If you host your website on shared IP address (main IP address of your server), you cannot access your website using IP address directly. You will always redirect to "http://IP/cgi-sys/defaultwebpage.cgi URL.
To access your website without pointing our domain to your server, you can use temporary URL. By default, it is enabled on the cPanel server. You can access the temporary URL using the following URL:
http://IP/~cpanel_user
Please note that the temporary URL does not work under the following configuration:
If you have enabled mod_userdir tweak and didn't exclude default host
If your server is configured to use mod_ruid2
Hope this information will help you with future use.

Categories