Jump to content
thirty bees forum
  • 0

Question

Posted

Anyone is using nginx to run thirtybees? and if yes does anyone mind sharing their config file? because i can't get seo url to work sadly. Thanks in advance.

5 answers to this question

Recommended Posts

  • 0
Posted

I use nginx. Took configs from there:

https://gist.github.com/julienbourdeau/79961e9caa4263e9e34d2d056948d335 https://github.com/MattLoyeD/Prestashop-Nginx https://gist.github.com/cosmic76/df4f1b986c10d383e83f0e474ab87b6b

Second one seems to be the most suitable.

  • 0
Posted

I get an error 403 with this config file:

``` server { #Use this to enable IPv6 servername domain.com; root /var/www/html/domain.com/publichtml; accesslog /var/log/nginx/access.log; errorlog /var/log/nginx/error.log;

index index.php index.html;

location = /favicon.ico {
    log_not_found off;
    access_log off;
}

location = /robots.txt {
    auth_basic off;
    allow all;
    log_not_found off;
    access_log off;
}

# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /. {
    deny all;
    access_log off;
    log_not_found off;
}

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 1;
gzip_buffers 16 8k;
gzip_http_version 1.0;
gzip_types application/json text/css application/javascript;

rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
rewrite ^/images_ie/?([^/]+).(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last;
rewrite ^/order$ /index.php?controller=order last;
location /admin-dev/ {                           #Change this to your admin folder
    if (!-e $request_filename) {
        rewrite ^/.*$ /admin-dev/index.php last; #Change this to your admin folder
    }
}
location / {
    if (!-e $request_filename) {
        rewrite ^/.*$ /index.php last;
    }
}

location ~ .php$ {
    fastcgi_split_path_info ^(.+.php)(/.*)$;
    try_files $uri =404;
    fastcgi_keep_conn on;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/php7.2-fpm.sock;  #Change this to your PHP-FPM location
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

}

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

} server { if ($host = domain.com) { return 301 https://$host$request_uri; } # managed by Certbot

listen 80;
listen [::]:80;
server_name domain.com;
return 404; # managed by Certbot

} ```

Any idea how to fix this? btw why it has to be such a pain in the ass with nginx meanwhile it just work with apache :(

  • 0
Posted

@dienzo said in Nginx config file:

Any idea how to fix this? btw why it has to be such a pain in the ass with nginx meanwhile it just work with apache

Because it is not an option to read documentation in any case, whether it is apache or nginx. ;)

Nginx configs are quite straightforward and clear, so i wonder why you've got a 403.

In order to get rid of mistakes in your nginx config i would do following: 1. Move section related to http and redirect to https into the very begin of config. "if" directive is excessive and useless in section related to http So i would amend it as: server_name example.com www.example.com; rewrite ^ https://example.com$request_uri? permanent;

  1. As far as i remember the "listen" directives should be at very begin of section
  2. Also i would check the 'public_html' permissions - usually it should be 755 and owned by 'www-data' user/group. In the nginx's config 'www-data' also should be set as the daemon's user/group

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...