1.nginx配置网站目录并修改访问的端口:nginx.conf文件

listen 666;//端口默认为80,修改后增强安全性
server_name www.lnmp.org;
index index.html index.htm index.php;
root /home/www;

2.nginx配置虚拟目录:

(1)修改nginx.conf,加载vhost中的配置项
include vhost/*.conf; (2)如在vhost里写一个配置项:test.conf server
{
listen 80;
server_name test.com;
index index.html index.htm index.php default.html default.htm default.php;
root /opt/www/test/www; location / {
index index.html index.htm index.php; if (!-e $request_filename) {
rewrite ^/(.+)$ /index.php/$1 last;
}
} location ~ .*\.(php|php5)?($|/)
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /opt/www/test/www/$fastcgi_script_name;
fastcgi_split_path_info ^(.+.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info; include fcgi.conf;
}

修改完后重启nginx:

/usr/bin/nginx -s reload

或/etc/init.d/nginx restart

Linux 防火墙开放特定端口

iptables是linux下的防火墙,同时也是服务名称。

service  iptables  status         查看防火墙状态
service iptables start 开启防火墙
service iptables stop 关闭防火墙
service iptables restart 重启防火墙
防火墙开放特定端口:

①文件/etc/sysconfig/iptables    

②添加:

     -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

       ★数字8080代表开放8080端口,也可以改成其他的端口★

③重启防火墙
 

最新文章

  1. 套用JQuery EasyUI列表显示数据、分页、查询
  2. JS隐形数据类型转换注意事项
  3. 实现3D旋转效果的方法
  4. markdown插件学习
  5. Unix: How to Install BerkeleyDB From Source
  6. oracle登陆连接的问题
  7. smarty 常用参数
  8. key转成pvf
  9. leetcode Longest Substring Without Repeating Characters python
  10. AngularJS概念概述和第一个使用例子
  11. SpringBoot应用的启动方式
  12. hibernate-第二章-关系映射
  13. 什么是crf
  14. 3. Go语言基本类型
  15. statsmodels中的summary解读(以linear regression模型为例)
  16. (转)Matlab矩阵的简单操作
  17. 最新Flume1.7 自定义 MongodbSink 结合TAILDIR Sources的使用
  18. oracle基础之游标的理解与使用
  19. OpenCV中对Mat里面depth,dims,channels,step,data,elemSize和数据地址计算的理解
  20. 【python】详解time模块功能asctime、localtime、mktime、sleep、strptime、strftime、time等函数以及时间的加减运算

热门文章

  1. EOJ 3.30 A. 打工时不可能打工的【贪心】
  2. 10.1综合强化刷题 Day1 morning
  3. SpringMVC_01:创建运行环境(Maven)
  4. Windows 10系统出现:“出现系统还原使用的卷影复制服务无法运行...”的问题解决
  5. 方程式组织EQUATION DRUG平台解析(提纲) —方程式组织系列分析报告之四
  6. redis--服务器与客户端
  7. #译# Core Data概述 (转)
  8. mac 安装 office
  9. df、du、fdisk:Linux磁盘管理
  10. TP如何进行批量查询