[英]Configuration issues with nginx/apache/php-fpm
首先,我對這台服務器完全陌生,因此請耐心等待。 我正在跟蹤下面有關我的magento網站的鏈接,但我在這里發布,因為這是服務器配置問題。
https://www.rosehosting.com/blog/magento-2-with-redis-varnish-and-nginx-as-ssl-termination/
我的nginx配置文件:
upstream fastcgi_backend {
server unix:/var/run/www.sock ;
}
server {
server_name website.com www.website.com;
listen 8080;
set $MAGE_ROOT /var/www/html/;
set $MAGE_MODE production; # or developer
access_log /var/log/nginx/website.com-access.log;
error_log /var/log/nginx/website.com-error.log;
include /var/www/html/nginx.conf.sample;
}
server {
listen 443 ssl http2;
server_name website.com www.website.com;
ssl_certificate /ssl/cert; # change with your SSL cert
ssl_certificate_key /ssl/key; # change with your SSL key
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'AES128+EECDH:AES128+EDH:!aNULL';
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 24h;
keepalive_timeout 300s;
location / {
proxy_pass http://127.0.0.1;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Ssl-Offloaded "1";
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
#proxy_hide_header X-Varnish;
#proxy_hide_header Via;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
我的Apache配置文件:
<IfModule mod_ssl.c>
<VirtualHost *:8443 >
ServerName "website.com:443"
ServerAlias "www.website.com"
ServerAlias "ipv4.website.com"
ServerAdmin "email"
UseCanonicalName Off
DocumentRoot "/var/www/html/"
CustomLog /var/www/logs/access_ssl_log combined
ErrorLog "/var/www/logs/error_log"
<IfModule mod_suexec.c>
SuexecUserGroup "apache" "apache"
</IfModule>
<IfModule mod_sysenv.c>
SetSysEnv PP_VHOST_ID "c0cadc45-f0fe-460b-a746-f0cf7e323d99"
</IfModule>
ScriptAlias "/cgi-bin/" "/var/www/html/cgi-bin/"
SSLEngine on
SSLVerifyClient none
SSLCertificateFile /ssl/cert-eE2sPr
SSLCACertificateFile /ssl/cert-EBBnFs
TimeOut 200001
#<IfModule mpm_event_module>
#ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
#</IfModule>
#ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1
<Directory /var/www/html/>
AllowOverride All
<IfModule mod_perl.c>
<Files ~ (\.pl$)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options +ExecCGI
allow from all
PerlSendHeader On
</Files>
</IfModule>
<filesMatch "\.php$">
SetHandler "proxy:fcgi://localhost:9000"
</filesMatch>
SSLRequireSSL
Options -Includes +ExecCGI
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteCond %{HTTP_HOST} ^website.com$ [NC]
#RewriteRule ^(.*)$ https://www.website.com$1 [L,R=301]
</IfModule>
<IfModule mod_security2.c>
</IfModule>
<Location />
CacheEnable disk
CacheHeader on
CacheDefaultExpire 600
CacheMaxExpire 86400
CacheLastModifiedFactor 0.5
ExpiresActive on
ExpiresDefault "access plus 5 minutes"
Header set Cache-Control "max-age=290304000, public"
FileETag All
</Location>
</VirtualHost>
</IfModule>
<VirtualHost *:8080 >
ServerName "website.com:80"
ServerAlias "www.website.com"
ServerAlias "ipv4.website.com"
ServerAdmin "email"
UseCanonicalName Off
DocumentRoot "/var/www/html/"
CustomLog /var/www/logs/access_log combined
ErrorLog "/var/www/logs/error_log"
<IfModule mod_suexec.c>
SuexecUserGroup "apache" "apache"
</IfModule>
<IfModule mod_sysenv.c>
SetSysEnv PP_VHOST_ID "c0cadc45-f0fe-460b-a746-f0cf7e323d99"
</IfModule>
ScriptAlias "/cgi-bin/" "/var/www/html/cgi-bin/"
<IfModule mod_ssl.c>
SSLEngine off
</IfModule>
TimeOut 200001
<Directory /var/www/html/>
AllowOverride All
<IfModule mod_perl.c>
<Files ~ (\.pl$)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options +ExecCGI
allow from all
PerlSendHeader On
</Files>
</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.fcgi$)>
SetHandler fcgid-script
Options +ExecCGI
</Files>
</IfModule>
<filesMatch "\.php$">
SetHandler "proxy:fcgi://localhost:9000"
</filesMatch>
Options -Includes +ExecCGI
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteCond %{HTTP_HOST} ^website.com$ [NC]
#RewriteRule ^(.*)$ http://www.website.com$1 [L,R=301]
</IfModule>
<IfModule mod_security2.c>
</IfModule>
<Location />
CacheEnable disk
CacheHeader on
CacheDefaultExpire 600
CacheMaxExpire 86400
CacheLastModifiedFactor 0.5
ExpiresActive on
ExpiresDefault "access plus 5 minutes"
Header set Cache-Control "max-age=290304000, public"
FileETag All
</Location>
</VirtualHost>
據我所知,我已經正確地完成了所有操作,但是卻收到404未找到nginx的錯誤,並且我可以看到nginx運行得很好,那么我在哪里出錯了?
原來這是一個配置問題,當我應該使用nginx用戶和nginx組時,我正在使用apache用戶和apache組,現在可以使用了
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.