Answer the question
In order to leave comments, you need to log in
After the transfer from the host of the OpenCart site, only the main page opens, the rest 404?
I googled posts that the problem is in .htaccess. but I can’t win in any way ((
The site works for me through other nginx proxy servers, it also provides certificates.
Here is the nginx proxy setting:
server {
if ($host = sotarobot.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 192.168.2.137:80;
server_name sotarobot.com;
location ~ /.well-known {
root /usr/share/nginx/html;
allow all;
}
location /phpmyadmin/ {
deny all;
}
if ($uri !~ /.well-known){
return 301 https://$host$request_uri;
}
}
server {
server_name sotarobot.com;
ssl_certificate /etc/letsencrypt/live/sotarobot.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/sotarobot.com/privkey.pem; # managed by Certbot
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
ssl_prefer_server_ciphers on;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_protocols TLSv1.2;
ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
charset utf-8;
index index.php index.html;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/sotarobot.com/*.conf;
access_log /var/log/nginx/sotarobot.com_access.log;
error_log /var/log/nginx/sotarobot.com_error.log notice;
ssi on;
listen 192.168.2.137:443 ssl;
# Сжатие
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types text/plain application/xml
application/javascript
text/css
text/js
text/xml
application/x-javascript
text/javascript
application/json
application/xml+rss;
# Прочие настройки
client_max_body_size 1000m;
client_body_buffer_size 128k;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
client_header_buffer_size 1k;
large_client_header_buffers 4 16k;
error_page 598 = @backend;
location ~ /.well-known {
root /usr/share/nginx/html;
allow all;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
limit_req zone=one burst=500 nodelay;
proxy_pass http://192.168.2.143;
}
}
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
# 2. In your opencart directory rename htaccess.txt to .htaccess.
# For any support issues please visit: http://www.opencart.com
Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|.twig|\.ini|\.log|(?<!robots)\.txt))">
Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]
### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off
# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off
# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M
# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M
# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200
# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200
# 7. disable open_basedir limitations
# php_admin_value open_basedir [email protected]:/var/www/html/sotarobot.com#
server{
listen 192.168.2.143:80;
#имя сервера:
server_name sotarobot.com;
#логи
access_log /var/log/nginx/sotar.access.log;
error_log /var/log/nginx/sotar.error.log;
# корневая директория
root /var/www/html/sotarobot.com;
index index.php index.html index.htm;
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
return 403;
error_page 403 /403_error.html;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location /index.html {
rewrite // permanent;
}
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|bmp|txt)$ {
access_log off;
expires 14d;
break;
}
location ~* \.(ico|pdf|flv)$ {
access_log off;
expires 1y;
break;
}
location ~ /\.ht {
deny all;
}
location ~ \.php$ {
try_files $uri = 404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
<?php
// HTTP
define('HTTP_SERVER', 'https://sotarobot.com/');
// HTTPS
define('HTTPS_SERVER', 'https://sotarobot.com/');
// DIR
define('DIR_APPLICATION', '/var/www/html/sotarobot.com/catalog/');
define('DIR_SYSTEM', '/var/www/html/sotarobot.com/system/');
define('DIR_IMAGE', '/var/www/html/sotarobot.com/image/');
define('DIR_STORAGE', DIR_SYSTEM . 'storage/');define('DIR_LANGUAGE', '/var/www/html/sotarobot.com/catalog/language/');
define('DIR_TEMPLATE', '/var/www/html/sotarobot.com/catalog/view/theme/');
define('DIR_CONFIG', '/var/www/html/sotarobot.com/system/config/');
define('DIR_CACHE', DIR_STORAGE . 'cache/');
define('DIR_DOWNLOAD', DIR_STORAGE . 'download/');
define('DIR_LOGS', DIR_STORAGE . 'logs/');
define('DIR_MODIFICATION', DIR_STORAGE . 'modification/');
define('DIR_SESSION', DIR_STORAGE . 'session/');
define('DIR_UPLOAD', DIR_STORAGE . 'upload/');
// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', '******');
define('DB_PASSWORD', '******');
define('DB_DATABASE', '*******');
define('DB_PORT', '3306');
define('DB_PREFIX', 'oc_');
Answer the question
In order to leave comments, you need to log in
location ~ \.php$ {
try_files $uri = 404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
Install and use apache as backend and nginx reverse proxy as frontend. Or generally one apache.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question