I have set up apache virtual host and have a site with below config (the website is working well): NB: The domain names below fictitious.
<VirtualHost *:80> ServerName www.bill.test.com ServerAlias bill.test.com Redirect / https://bill.test.com/ </VirtualHost> <VirtualHost *:443> ServerName www.bill.test.com ServerAlias bill.test.com DocumentRoot /applications/www/bill.test.com/public_html/public SSLEngine on SSLCertificateFile /home/user1/ssl_certificate/test.com/wildcard_eneoapps_com.crt SSLCertificateKeyFile /home/user1/ssl_certificate/test.com/wildcard_eneoapps_com.key SSLCertificateChainFile /home/user1/ssl_certificate/test.com/DigiCertCA.crt ErrorLog /applications/www/bill.test.com/error.log CustomLog /applications/www/bill.test.com/requests.log combined <Directory "/applications/www/bill.test.com/public_html/public"> AllowOverride All </Directory> </VirtualHost>
Also, on this server I have an API located in the directory below:
Now when I try to call this API in the code, I get the error below:
Client error: `POST http://12.ipp.106.21/ebill-api/public/api/login' resulted in a `404 Not Found` response:\n
My httpd.conf file looks like below:
DocumentRoot "/applications/www/html" # # Relax access to content within /var/www. # <Directory "/applications/www"> AllowOverride None # Allow open access: Require all granted </Directory> # Further relax access to the default document root: <Directory "/var/www/html"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Require all granted </Directory>
Please help as I am new to configuring apache and confuse why this doesn't work. I was able to call an API on a separate server but I don't understand why calling this one which is on thesame server as the website is not working.
Since you have the Laravel api in a subfolder, you should adjust the APP_URL in your .env file to be
Try this change. See if it help.