Skip to main content
Topic: nginx? (Read 1780 times) previous topic - next topic

nginx?

It would be a good option to put nginx as the engine. Although it is for when it is sent to production, apache has thousands of errors in production, especially on Linux server and more if it is in containers. I have been struggling for days to be able to put my apps into production and I still cannot do it.


Re: nginx?

Reply #2


hi @willvin
I still can't get nginx to work with phprad. I leave my conf to see if they can help me.

Code: [Select]
server
{
    listen 80;
listen 443 ssl;
    server_name mysite.org;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/mysite.org;
   
    #SSL-START SSL related configuration, do NOT delete or modify the next line of commented-out 404 rules
    #error_page 404/404.html;
    limit_conn perserver 300;
    limit_conn perip 25;
    limit_rate 512k;
    #HTTP_TO_HTTPS_START
    if ($server_port !~ 443){
        rewrite ^(/.*)$ https://$host$1 permanent;
    }
    #HTTP_TO_HTTPS_END
    ssl_certificate    /www/server/panel/vhost/cert/mysite.org/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/mysite.org/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    error_page 497  https://$host$request_uri;

    #SSL-END
   
    #ERROR-PAGE-START  Error page configuration, allowed to be commented, deleted or modified
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END
   
    #PHP-INFO-START  PHP reference configuration, allowed to be commented, deleted or modified
    #SECURITY-START Hotlink protection configuration
    location ~ .*\.(jpg|jpeg|gif|png|js|css)$
    {
        expires      30d;
        access_log off;
        valid_referers none blocked mysite.org;
        if ($invalid_referer){
           return 404;
        }
    }
    #SECURITY-END
    include enable-php-74.conf;
    #PHP-INFO-END
   
    #REWRITE-START URL rewrite rule reference, any modification will invalidate the rewrite rules set by the panel
    include /www/server/panel/vhost/rewrite/mysite.org.conf;
    #REWRITE-END
   
    # Forbidden files or directories
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
   
    # Directory verification related settings for one-click application for SSL certificate
    location ~ \.well-known{
        allow all;
    }
   
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log off;
        access_log off;
    }
   
    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log off;
        access_log off;
    }
    access_log  /www/wwwlogs/mysite.org.log;
    error_log  /www/wwwlogs/mysite.org.error.log;
}