I'm attempting to move a CakePHP app to an Azure App Service with PHP 8.1 from PHP 7.4. I'm having difficulty figuring out the required nginx configurations to make it work.
I took the base nginx configuration, added the changes from the CakePHP book and I'm injecting the configuration file during startup (cp /home/default /etc/nginx/sites-enabled/default
).
I keep getting 404 errors except on the root page. On the index page, layout issues are also occurring due to those links returning 404 too.
server {
#proxy_cache cache;
#proxy_cache_valid 200 1s;
listen 8080;
listen [::]:8080;
#root /home/site/wwwroot;
root /home/site/wwwroot/webroot;
#index index.php index.html index.htm;
index index.php;
server_name example.com www.example.com;
port_in_redirect off;
#location / {
# index index.php index.html index.htm hostingstart.html;
#}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /html/;
}
# Disable .git directory
location ~ /\.git {
deny all;
access_log off;
log_not_found off;
}
#added from CakePHP book
location / {
try_files $uri $uri/ /index.php?$args;
}
#added from CakePHP book
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# Add locations of phpmyadmin here.
#location ~ [^/]\.php(/|$) {
# fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
# fastcgi_pass 127.0.0.1:9000;
# include fastcgi_params;
# fastcgi_param HTTP_PROXY "";
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param PATH_INFO $fastcgi_path_info;
# fastcgi_param QUERY_STRING $query_string;
# fastcgi_intercept_errors on;
# fastcgi_connect_timeout 300;
# fastcgi_send_timeout 3600;
# fastcgi_read_timeout 3600;
# fastcgi_buffer_size 128k;
# fastcgi_buffers 4 256k;
# fastcgi_busy_buffers_size 256k;
# fastcgi_temp_file_write_size 256k;
#}
}
I failed to add theservice nginx restart
command following the copy. Seems to work now.
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
CakePHP is a framework that has been around since 2005 and is known for the convenience it gives web developers. It needs very modest settings, does not require the use of XML or YAML files. It has its own ORM, which sets it apart from other similar tools. In terms of security, it is also doing well, in particular, it has a protection system against CSRF attacks.
https://cakephp.org/
HTML (English "hyper text markup language" - hypertext markup language) is a special markup language that is used to create sites on the Internet.
Browsers understand html perfectly and can interpret it in an understandable way. In general, any page on the site is html-code, which the browser translates into a user-friendly form. By the way, the code of any page is available to everyone.
https://www.w3.org/html/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.