Laravel app/public folder on Azure App Service (with nginx) - php

We need to publish a Laravel 8 project on Azure App Services, configured with nginx.
We only have FTPS access and the server runs on nginx. We do not have root or Azure UI access.
We tried to change the public path in server.php to /wwwroot or the relative path to the bootstrap and vendor, as suggested by several posts. Changed webpack mix path etc. But we keep on getting 404 (even though the index.php is there).
How can we configure Laravel to serve the app correctly?

Just to highlight, yes Linux PHP v8 blessed images are defaulted to nginx/php-fpm. So, you will not need .htaccess, however, you may try with rewrite rules to mimic .htaccess.
You can configure using startup command.
Azure App Service on Linux FAQ
Just to confirm, does it work locally fine as expected? You try these to isolate the issue further.
• Access the log stream.
• Test the app locally in production mode. App Service runs your app in production mode, so you need to make sure that your project works as expected in production mode locally.
For example:
o Depending on your composer.json, different packages may be installed for production mode (require vs. require-dev).
o Certain web frameworks may deploy static files differently in production mode.
o Certain web frameworks may use custom startup scripts when running in production mode.
• Run your app in App Service in debug mode. In Laravel, you can configure your app to output debug messages in production by setting the APP_DEBUG app setting to true.
If your requirement fits, you may deploy your Laravel application with a custom Docker image instead.

Related

SOS! How do I deploy multiple Laravel apps on a windows IIS server in a LAN

I am setting up an IIS server in readiness to host multiple PHP web apps. These will be used within our local network so no need internet access. I have read a lot of stuff on how to go about it but am getting lost even more. someone please help.
You can refer to this document for detailed steps about deploy php application on IIS.
Here are some main important points:
Install IIS in control pannel(windows) or server manager(windows server).
Configure php. Youcan download it from php official website or Web PI(more recommand). The version over php8 may not work on IIS.
Make the physical path of site points to root folder of application. It will auto generate web.config. Set the permission of root folder to avoid 500 error.
If you have multiples version of php, you can isntall php manager to configure them.

Google Cloud Platform : How to develop on my local environment with GCP resources

I'm using Google App Engine Flex to develop an angularjs/php-rest backend application.
I've a successful port from regular servers to AppEngine, and I now want to integrate more with GCP services like : StackDriver, Cloud Storage and so on.
StackDriver to have logging & monitoring.
Cloud Storage: to store export data files and zip them before sending it to browser.
My question is how do I develop locally on my laptop (which can be online & offline) ?
I didn't find in the documentation "the way" of local development :
Should stackDriver or Cloud Storage client be configured to write on disk instead of reaching GCP ?
Should I configure some proxy (like the cloud_sql_proxy) to be able to reach GCP ? Should I create a project for my local dev ? How does it work if I'm offline ?
Any hint appreciated :)
App Engine Flexible doesn't come with a development server or service emulators for use during development so you may use the services directly.
Stackdriver Logging: logs written to stdout and stderr are automatically sent to Stackdriver Logging for you, without needing to use Stackdriver Logging library for PHP. This may be enough for you to get logs locally but we recommend that you use the PSR-3 logger which automatically adds metadata to your logs so that your application logs are correlated to the request logs. You can set it up to run locally and log to your project by following the doc here.
Stackdriver Monitoring: Google App Engine includes built-in support for Monitoring in the flexible environment (when deployed) and doesn't require configuration. The monitoring agent cannot be installed on your local machine though, but it would be pointless to monitor it anyway.
Cloud Storage: an easy option is to create a dev bucket that you can use during development. You can create it in whichever project you wish and grant permissions to your development service account.
One common practice is to create different GCP projects for prod, staging and dev purposes. This allows you to create specific resources for a given environment. Taking logging as example, you'll be able to see logs and troubleshoot any issue with it within the dev project, without polluting your prod project's logs. That'd be true with CloudSQL, Datastore, etc...
You don't need to configure any proxy for those services. The cloud_sql_proxy is a convenient method to enforce secure connections and ease authentication with CloudSQL instances without the need to whitelist IP addresses.
Regarding the offline situation now, of course those calls from your local app to those services will fail if you don't have internet connection at that time (intermittent disconnections may actually help you to test your retries and error handling mechanisms). If you expect to develop with no internet connection at all though, you'll need to write stub services to mimic the expected behavior locally.

How to host Codeigniter app on Azure?

I wanted to ask you to help me (with some tutorial link or something), what i want to do is to upload php Codeigniter application on azure?
Also in my application, I got upload feature so I should make it work too (don't know if it's more complex becasue of that).
I was using wamp during developing, now I need to push it on server.
Generally, deploy a CI application to Azure Web Apps is simple, you can simply create an Azure Web Apps on Azure portal, then step in the manage page of your Azure Web Apps, click All settings=>deployment source=>chose source=>Local Git Repository to set the git deployment setting of your Azure Web Apps service.
Then you can find the Git clone url under the essential tab.
Additionally, Azure App Service can run php composer.phar install when you run git push, but it's not enabled by default. To enable it, you need to install the Composer extension for your web app.
Here is a CI template on Azure sample, you can refer to https://github.com/Azure-Samples/app-service-web-php-get-started for any hits.
And here is a video https://youtu.be/bBb_Hi2Odqc, you can refer to. It manages on the classic portal, but still works today.
Deploying Codeigniter is very easy, all you need to make sure is placing the project directory correctly.
Just upload the project folder to the hosting either by SSH or FTP.
Modify the .htaccess file accordingly.
Once all the above is set up, including uploading all the files to host, don't forget to update config.php database.php and route.php with new hosting parameters.
To make your upload feature work correctly you just need to give proper/required write access to the upload folder of the application.
And that's all you need to do while deploying Codeigniter application.

laravel 5.1 on windows azure web application

I want to deploy a laravel app on my azure web application
but that return this error
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
I know my web.config was setting error ..
I search some resource also can't resolve my question ...
http://blog.bobbyallen.me/2015/06/26/configuring-and-hosting-laravel-5-x-applications-on-windows-azure/
Actually, Azure Web site’s root directory is site\wwwroot, when we are deploying projects from Github to Azure Web Apps, Azure will automatically move the project to the root path site\wwwroot. So it is not necessary to change the root directory.
On my side, I cloned your project, deployed it on Azure by git, and browsed the URL <site_name>. azurewebsites.net/public to check project. I got the error message about the project couldn’t find the file vendor/autoload.php, so it looks like the project was lack of dependence.
I installed composer as the article you provided told in KUDU Console site. The URL should be https://<your_site_name>.scm.azurewebsites.net/ (first installed composer, we need to restart the console site).
Then click “Debug console”=>”CMD” at the header navigation of the console site to enter in command line tool, change directory to D:\home\site\wwwroot and run composer install, after finishing installation, we browse <site_name>.azurewebsites.net/public again, and it works well.
To set the URL rewrite to remove the “public”, we can simply modify “site\wwwroot” to “site\wwwroot\public” at virtual applications and directories section in Azure portal.
In addition you may want PHP project to show detailed errors during testing. By default, “display_errors” is off, we can simply create a file named “.user.ini” in the root directory and wirte “display_errors = on” in this file. Please read this article for more information.

unable to deploy symfony project to a shared hosting web server

i am using Symfony 1.4, to create my project. i have tried to deploy project using the command and methods given in chapter-16 in symfony book. but i am not able to deploy my symfony project from my local computer to web server. Can i directly copy paste my symfony project to my web server?? will that work?? or is there any other method??
NOTE: i am using Propel as ORM.
Your best option is:
1. gzip up the entire project
2. export all the data from the database using something like mysqldump
3. upload the files to the server
4. import the database dump into your server database
5. unzip your project
A couple notes:
1. Due to the shared hosting environment, you may have security issues due to other hosts on the server gaining access to your php files See here.
2. Hopefully your host allows SSH access to your server account, administering a symfony project is MUCH easier when this is the case.
3. If you don't have SSH access to your account you will have to upload the files to the server without gzipping them and this takes a LONG time due to the number of files symfony creates.
4. If possible place all your symfony files except for the web folder outside the public_html folder.
When I have to deploy something I do this:
Check if the requirement (php5, mysql4 etc) on the production server matches my application.
Change the configuration files to reflect the production server.
Upload everything to the server using ftp.
Your question is cryptic, you should really specify what kind of error you are getting.

Categories