這是我試圖部署一個小的PHP應用程序的第三天。 我們將我們的應用程序,這是3軌應用程序和1個PHP到同一臺服務器。 Rails應用程序工作正常。 PHP不。 我從來沒有真正部署PHP應用程序,所以我通過指南來完成它。到目前爲止,我得到這種情況: 如果我嘗試在瀏覽器中打開PHP應用程序,我會看到默認的Apache頁面。如果我刷新頁面,它會顯示index.php文件的內容,但是會顯示爲空白文本。再次刷新 - 默認的Apache頁面,再次 - index.php的內容。PHP應用程序部署Ubuntu 16.04 nginx Apache設置
我的設置:
的nginx /網站可用/ my.site(啓用了啓用的站點 - )
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/my.site/httpdocs;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name my.site www.my.site;
location/{
proxy_pass http://localhost:8000;
include /etc/nginx/proxy_params;
}
location ~* \.(js|css|jpg|jpeg|gif|png|svg|ico|pdf|html|htm)$ {
expires 30d;
}
location @proxy {
proxy_pass http://127.0.0.1:8000;
include /etc/nginx/proxy_params;
}
location ~* \.php$ {
proxy_pass http://127.0.0.1:8000;
include /etc/nginx/proxy_params;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
}
的Apache2 /網站可用/ my.site
ServerName my.site
ServerAlias www.my.site
ServerAdmin [email protected]
DocumentRoot /var/www/my.site/httpdocs
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
的Apache2/ports.conf
NameVirtualHost 127.0.0.1:8000
Listen 8000
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
在休息日工作不知道如何解決服務器。任何建議表示讚賞。
我可以知道你爲什麼要使用nginx的作爲代理阿帕奇? – Albert221
@ Albert221我對你沒有適當的答案。我剛剛開始谷歌'的Ubuntu的PHP Apache部署'和那些指南出現了。你能提供更好的解決方案嗎 – alexxero