TA的每日心情 | 奋斗 2013-6-21 12:27 |
---|
签到天数: 26 天 连续签到: 1 天 [LV.4]偶尔看看III
|
本帖最后由 xinxincaijq 于 2013-12-16 13:54 编辑
http://blog.csdn.net/spaceship20008/article/details/8456601 原帖地址
貌似复制过来失真。还没有直接填写html代码的权限。
On Rapsberry Pi, Using Archlinux to build LNMP, linux, Nginx, MySQL, PHP- [root@alarmpi /]# pacman -S php php-cgi php-fpm php-curl php-gd php-mcrypt mysql mysql-clients nginx
- WARNING: The host 'alarmpi' could not be looked up with resolveip.
- This probably means that your libc libraries are not 100 % compatible
- with this binary MySQL version. The MySQL daemon, mysqld, should work
- normally with the exception that host name resolving will not work.
- This means that you should use IP addresses instead of hostnames
- when specifying MySQL privileges !
- Installing MySQL system tables...
- OK
- Filling help tables...
- OK
- To start mysqld at boot time you have to copy
- support-files/mysql.server to the right place for your system
- PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
- To do so, start the server, then issue the following commands:
- /usr/bin/mysqladmin -u root password 'new-password'
- /usr/bin/mysqladmin -u root -h alarmpi password 'new-password'
- Alternatively you can run:
- /usr/bin/mysql_secure_installation
- which will also give you the option of removing the test
- databases and anonymous user created by default. This is
- strongly recommended for production servers.
- See the manual for more instructions.
- You can start the MySQL daemon with:
- cd /usr ; /usr/bin/mysqld_safe &
- You can test the MySQL daemon with mysql-test-run.pl
- cd /usr/mysql-test ; perl mysql-test-run.pl
- Please report any problems with the /usr/scripts/mysqlbug script!
- (6/8) installing geoip-database [######################] 100%
- (7/8) installing geoip [######################] 100%
- (8/8) installing nginx [######################] 100%
复制代码 这里有一些extensions, 注释掉刚刚安装的这些模块。以让他们起作用。- ;extension=bcmath.so
- ;extension=bz2.so
- ;extension=calendar.so
- extension=curl.so
- ;extension=dba.so
- ;extension=enchant.so
- ;extension=exif.so
- ;extension=ftp.so
- extension=gd.so
- extension=gettext.so
- ;extension=gmp.so
- ;extension=iconv.so
- ;extension=imap.so
- ;extension=intl.so
- ;extension=ldap.so
- extension=mcrypt.so
复制代码 然后- vim /etc/php/php-fpm.conf
复制代码 去掉注释成这样:- ;listen = 127.0.0.1:9000
- listen = /run/php-fpm/php-fpm.sock
复制代码 我们用上面的unix格式,目的是为了以后能更好的使用,
其他的先不做调整
参考内容有:https://wiki.archlinux.org/index.php/Nginx#Installation_in_a_chroot修改下面的文字,- open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/nginx/html/
复制代码 后面加上那行:/usr/share/nginx/html/
这个是告诉php这个存放php的文件夹可以解析
然后我们调整Nginx.conf- vim /etc/nginx/nginx.conf #修改成如下的格式
复制代码- #user html;
- worker_processes 1;
- error_log /var/log/error.log;
- #error_log logs/error.log notice;
- #error_log logs/error.log info;
- #pid /var/run/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 /var/log/access.log main;
- sendfile on;
- #tcp_nopush on;
- #keepalive_timeout 0;
- keepalive_timeout 65;
- gzip on;
- server {
- listen 81;
- server_name localhost;
- root /usr/share/nginx/html;
- #charset koi8-r;
- charset utf-8;
- #access_log logs/host.access.log main;
- location / {
- index index.html index.htm;
- root /usr/share/nginx/html;
- }
- #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 http://127.0.0.1;
- #}
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- location ~ \.php$ {
- root /usr/share/nginx/html;
- #try_files $uri =404;
- #fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include /etc/nginx/fastcgi_params; #默认在/etc/nginx/ 下面有许多配置文件
- }
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- #
- location ~ /\.ht {
- deny all;
- }
- }
- 85,0-1 45%
复制代码 然后- systemctl enable php-fpm.service
- systemctl enable nginx.service
- systemctl start php-fpm.service
- systemctl start nginx.service
复制代码 目的是能让开机启动
用命令行下的万维网浏览器elinks
进入elinks,输入http://localhost/hi.php
显示
hello world! this is a php script.
显示完成。PHP环境搭建成功。
剩下的安装模块,修改php.ini, php-fpm.conf , nginx.conf
按照用户个人需求来完成。MySQL具体操作,是通过PHP的。当然也可以远程操作。这取决于怎么使用。
先这样分享给大家吧,祝大家新年快乐!~
|
|