Home > Enterprise >  nginx configration on azure
nginx configration on azure

Time:11-21

I want to change the links to be SEO-friendly. But I couldn't run it properly so far. Please advise me on a solution to this problem. Also, I have a startup command like "cp /home/default /etc/nginx/sites-enabled/default; service nginx restart" on azure-> ->configration->General Settings Here is my Nginx server block.

server {
    #proxy_cache cache;
   #proxy_cache_valid 200 1s;
    listen 8080;
    listen [::]:8080;
    absolute_redirect off;
    root /home/site/wwwroot;
    index  index.php index.html index.htm;
    #server_name  sitename.azurewebsites.net[; 

    location / {            
        index  index.php;
    try_files $uri $uri/ /index.php?$args;
    }

    # 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;
    }

    # 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;
    }
}

enter image description here

CodePudding user response:

Based on the above shared information, we have understood that you are trying to create custom startup by passing the commands in startup command under configurations in the portal.

You need to use service nginx reload instead of service nginx restart as mentioned in this sample documentation on how to change the rewrite rule in PHP 8 azure webapps.

For custom startup script it is always recommended to create file under /home named startup.txt, startup.sh, or another name of your choice that contains your startup command(s) and pass the path of the file to the startup command under configuration in the portal.

  • Related