一、安装php
pacman -S php php-gd php-intel php-mcrypt php-fpm php-pgsql
leafpad /etc/php/php.ini
找到类似这样的
;extension=bcmath.so
;extension=bz2.so
;extension=calendar.so
extension=curl.so
;extension=dba.so
;extension=enchant.so
;extension=exif.so
;extension=ftp.so
去掉
gd.so
iconv.so
xmlrpc.so
zip.so
bz2.so
curl.so
intl.so
mcrypt.so
openssl.so
pdo_pgsql.so
pgsql.so
前面的;号
;date.timezone = 改成 date.timezone = Asia/Shanghai
二、安装nginx web服务器
# pacman -S nginx
启动服务
要启动Nginx服务,运行以下命令:
# systemctl enable nginx
要Nginx服务开机时启动,运行以下命令:
# systemctl start nginx
在浏览器中输入 出现的默认页面是:
Welcome to nginx!
启动php-fpm
# systemctl enable php-fpm
# systemctl start php-fpm
初次测试
在当前用户目录下建一个new文件目录
内建一个index.html
内容为
Welcome to nginx!
Welcome to nginx!
#chown -R http:http /home/当前目录/new
#vi /etc/nginx/nginx.conf
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#将下面这一行改成root /home/当前目录/new;
root /usr/share/nginx/html;
index index.html index.htm index.php;
}
如果出现Welcome to nginx!
成功了。
再内建一个index.php
内容为
phpinfo();
?>
#chown -R http:http /home/当前目录/new
#vi /etc/nginx/nginx.conf
将这段
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
改成
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
root /home/qwer/new;
location / {
index index.php;
}
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location = /favicon.ico {
log_not_found off;
}
改过后要
systemctl restart nginx
systemctl restart php-fpm
在浏览器中输入 出现的默认页面是: php的调试页
说明你成功了
三、安装owncloud
下载owncloud包
% tar xvjf owncloud-8.0.0.tar.bz2
在自己的用户目录下就有了一个owncloud文件夹
#chown -R http:http /home/当前目录/new
当出现owncloud的页面就成功了。( No database drivers (sqlite, mysql, or postgresql) installed.)
四、postgresql
pacman -S postgresql
新建一个放数据库的文件夹
mkdir mydata
将mydata的所有权改成postgres用户
sudo chown -c -R postgres:postgres mydata
sudo -i -u postgres
initdb --locale en_US.UTF-8 -E UTF8 -D '/home/当前目录/mydata'
# systemctl enable postgresql
# systemctl start postgresql
创建一个超级用户
createuser -s -U postgres --interactive
输入要增加的用户名: 最好与我登录Arch的用户名同名
创建一个数据库
createdb myDatabaseName
出现错误 Your data directory and files are probably accessible from the internet because the .htaccess file does not work. For information how to properly configure
#vi /etc/nginx/nginx.conf
加入
location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){
deny all;
}
出现错误
/index.php/apps/files/
404 Not Found
这个问题是最烦人,找了很多网站,没找到,花了三四个晚上,太痛苦了。
下面是我的/etc/nginx/nginx.conf
大家自己研究吧。
#user html;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
root /home/qwer/owncloud;
location / {
index index.php;
rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
}
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location = /favicon.ico {
log_not_found off;
}
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){
deny all;
}
#error_page 404 /404.html;
# 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;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass [url][/url];
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
阅读(1697) | 评论(0) | 转发(0) |