Update 2016-02-12:修复了Nginx下 PATH_INFO 兼容设置带来的伪静态URL无法使用问题。
服务器配置
- Ubuntu 14.04.3 LTS (GNU/Linux 3.16.0-60-generic x86_64)
- Nginx 1.9.11
- PHP 5.5.9-1ubuntu4.14
- Percona Server 5.6.28-76.1
安装流程
Nginx配置文件 /etc/nginx/conf.d/ocs.conf :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
server { listen 80; listen [::]:80; server_name ocs.example.com; root /usr/share/nginx/ocs; location / { index index.php; try_files $uri $uri/ /index.php?$args; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # pass the PHP scripts to uWSGI server # See: https://blog.phoenixlzx.com/2015/12/21/migrating-to-uwsgi/ # location ~ \.php { include uwsgi_params; uwsgi_modifier1 14; uwsgi_pass unix:/var/run/uwsgi-php.sock; } } |
建立数据库和相应用户:
1 2 3 4 5 6 |
-- mysql -u root -p CREATE DATABASE ocs DEFAULT CHARACTER SET utf8; CREATE USER 'ocsuser'@'localhost' IDENTIFIED BY 'your-great-unhackable-password'; GRANT ALL ON ocs.* TO 'ocsuser'@'localhost' ; FLUSH PRIVILEGES; QUIT; |
建立文件存储目录:
1 2 |
sudo mkdir /usr/share/nginx/ocs/files sudo chown -R www-data:www-data /usr/share/nginx/ocs/files |
然后访问网站根目录完成安装流程。
好快,大家几乎都上了1.9.11
跟着 mainline 就升级了呀