您的位置:首页 > 运维架构 > Nginx

简单使用nginx和mysql

2014-05-09 22:16 267 查看
简单使用nginx和mysql

Editor Feng / February 25, 2014 / No comments

/srv/www/wordpress/public_html;在使用树莓派搭建wordpress博客的过程中,

先做 apt-get

再对nginx进行配置:在/etc/nginx/sites-sites-enabled和sites-sites-available下需要配置相同文件,这里对命令的解释如下:

# Upstream to abstract backend connection(s) for php

upstream php {

server unix:/var/run/php5-fpm.sock;

}

server {

## Your only path reference.

root /srv/www/wordpress/public_html;//root用户在此加入文件,www目录,可以变化到其他位置

listen 80;

## Your website name goes here. Change to domain.ltd in VPS

server_name _;

access_log /srv/www/wordpress/logs/access.log;

error_log /srv/www/wordpress/logs/error.log; 日志名

## This should be in your http block and if it is, it’s not needed here.

index index.php index.html index.htm ;

location = /favicon.ico {

log_not_found off;

access_log off;

}

location = /robots.txt {

allow all;

log_not_found off;

access_log off;

}

location / {

# This is cool because no php is touched for static content

try_files $uri $uri/ /index.php;

}

location ~ \.php$ {

#NOTE: You should have “cgi.fix_pathinfo = 0;” in php.ini

include fastcgi_params;

fastcgi_intercept_errors on;

fastcgi_pass php;

}

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {

expires max;

log_not_found off;

}

}

接下来需要进行权限设置:对www目录权限设置 chmod 775 /srv/www/wordpress/ -R

重启 service nginx restart

在配置好nginx后,我们可以使用mysql数据库

其进入命令行的方法为,, mysql -u root -p

接着进入enter输入密码
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: